Jump to content

Question

Posted

Salut, as vrea sa va intreb daca am facut ceva gresit la aceste comenzi de nu imi salveaza in baza de date ?

 

 

QUITJOB:

CMD:quitjob(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pJob] >= 1)
        {
            SendClientMessage(playerid, COLOR_GREY, "You have quit your job!");
            PlayerInfo[playerid][pJob] = 0;
            DisablePlayerCheckpoint(playerid);
            new szQuery[128];
            mysql_format(mysql, szQuery, sizeof(szQuery), "UPDATE `users` SET `Job`='0' WHERE `Username`='%s'", PlayerInfo[pJob], PlayerInfo[playerid][pUsername]);
            mysql_tquery(mysql, "szQuery");
        }
        else return SendClientMessage(playerid, COLOR_WHITE, "You don't have a job.");
    }
    return 1;
}

 

GETJOB:

CMD:getjob(playerid, params[])
{
    new szQuery[256];
    if(IsPlayerConnected(playerid))
    {
        new sendername[25],str[256];
        GetPlayerName(playerid,sendername,sizeof(sendername));
        if(PlayerInfo[playerid][pJob] == 0)
        {
            if (GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,607.8375,-1438.1827,14.0654))
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Jobul tau este acum Detective.");
                PlayerInfo[playerid][pJob] = 1;
                mysql_format(mysql, szQuery, sizeof(szQuery), "UPDATE `users` SET `Job`='%d' WHERE `Username`='%s'", PlayerInfo[playerid][pJob], PlayerInfo[playerid][pID]);
                mysql_tquery(mysql, szQuery);
            }
            else if (GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,359.3762,-2071.5310,10.6953))
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Jobul tau este acum Fisherman.");
                PlayerInfo[playerid][pJob] = 2;
                mysql_format(mysql, szQuery, sizeof(szQuery), "UPDATE `users` SET `Job`='%d' WHERE `Username`='%s'", PlayerInfo[playerid][pJob], PlayerInfo[playerid][pID]);
                mysql_tquery(mysql, szQuery);
            }

        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Ai deja un job, foloseste comanda /quitjob pentru a parasi job ul.");
        }
    }
    return 1;
}

 

SETJOB: 

CMD:setjob(playerid, params[])
{
    new szQuery[256];
    if(IsPlayerConnected(playerid))
    {
        if (PlayerInfo[playerid][pAdmin] >= 6)
        {
            new id,jobid,string[256],giveplayer[30],sendername[30];
            if(sscanf(params, "ui",id,jobid)) return SendClientMessage(playerid, 0xFFFFFFFF, "{0049FF}Syntax: {ffffff}/setjob <Name/Playerid> <Job ID>");
            {
                if(IsPlayerConnected(id))
                {
                    if(id != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(id, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerInfo[id][pJob] = jobid;
                        format(string, sizeof(string), "Admin %s has changed you job to %d.", sendername,jobid);
                        SCM(id,COLOR_LIGHTBLUE, string);
                        new str[128];
                        mysql_format(mysql, szQuery, sizeof(szQuery),"UPDATE `users` SET `Job`='%d' WHERE `name`='%s'",PlayerInfo[id][pJob],PlayerInfo[id][pUsername]);
                        mysql_tquery(mysql, szQuery);
                    }
                }
                else
                {
                    SendClientMessage(playerid,COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, AdminOnly);
        }
    }
    return 1;
}

 

Mersi!

3 answers to this question

Recommended Posts

  • 0
Posted
1 hour ago, Micu_Gamer said:

Salut, as vrea sa va intreb daca am facut ceva gresit la aceste comenzi de nu imi salveaza in baza de date ?

 

 

QUITJOB:

CMD:quitjob(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pJob] >= 1)
        {
            SendClientMessage(playerid, COLOR_GREY, "You have quit your job!");
            PlayerInfo[playerid][pJob] = 0;
            DisablePlayerCheckpoint(playerid);
            new szQuery[128];
            mysql_format(mysql, szQuery, sizeof(szQuery), "UPDATE `users` SET `Job`='0' WHERE `Username`='%s'", PlayerInfo[pJob], PlayerInfo[playerid][pUsername]);
            mysql_tquery(mysql, "szQuery");
        }
        else return SendClientMessage(playerid, COLOR_WHITE, "You don't have a job.");
    }
    return 1;
}

 

GETJOB:

CMD:getjob(playerid, params[])
{
    new szQuery[256];
    if(IsPlayerConnected(playerid))
    {
        new sendername[25],str[256];
        GetPlayerName(playerid,sendername,sizeof(sendername));
        if(PlayerInfo[playerid][pJob] == 0)
        {
            if (GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,607.8375,-1438.1827,14.0654))
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Jobul tau este acum Detective.");
                PlayerInfo[playerid][pJob] = 1;
                mysql_format(mysql, szQuery, sizeof(szQuery), "UPDATE `users` SET `Job`='%d' WHERE `Username`='%s'", PlayerInfo[playerid][pJob], PlayerInfo[playerid][pID]);
                mysql_tquery(mysql, szQuery);
            }
            else if (GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,359.3762,-2071.5310,10.6953))
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Jobul tau este acum Fisherman.");
                PlayerInfo[playerid][pJob] = 2;
                mysql_format(mysql, szQuery, sizeof(szQuery), "UPDATE `users` SET `Job`='%d' WHERE `Username`='%s'", PlayerInfo[playerid][pJob], PlayerInfo[playerid][pID]);
                mysql_tquery(mysql, szQuery);
            }

        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Ai deja un job, foloseste comanda /quitjob pentru a parasi job ul.");
        }
    }
    return 1;
}

 

SETJOB: 

CMD:setjob(playerid, params[])
{
    new szQuery[256];
    if(IsPlayerConnected(playerid))
    {
        if (PlayerInfo[playerid][pAdmin] >= 6)
        {
            new id,jobid,string[256],giveplayer[30],sendername[30];
            if(sscanf(params, "ui",id,jobid)) return SendClientMessage(playerid, 0xFFFFFFFF, "{0049FF}Syntax: {ffffff}/setjob <Name/Playerid> <Job ID>");
            {
                if(IsPlayerConnected(id))
                {
                    if(id != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(id, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerInfo[id][pJob] = jobid;
                        format(string, sizeof(string), "Admin %s has changed you job to %d.", sendername,jobid);
                        SCM(id,COLOR_LIGHTBLUE, string);
                        new str[128];
                        mysql_format(mysql, szQuery, sizeof(szQuery),"UPDATE `users` SET `Job`='%d' WHERE `name`='%s'",PlayerInfo[id][pJob],PlayerInfo[id][pUsername]);
                        mysql_tquery(mysql, szQuery);
                    }
                }
                else
                {
                    SendClientMessage(playerid,COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, AdminOnly);
        }
    }
    return 1;
}

 

Mersi!

pot sa iti dau comenzile terminate?

Daca da,uitele aici

 

QUITJOB:

CMD:quitjob(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pJob] >= 1)
        {
            SendClientMessage(playerid, COLOR_GREY, "You have quit your job!");
            PlayerInfo[playerid][pJob] = 0;
            DisablePlayerCheckpoint(playerid);
            new szQuery[128];
            mysql_format(mysql, szQuery, sizeof(szQuery), "UPDATE `users` SET `Job`='0' WHERE `Username`='%s'", PlayerInfo[playerid][pUsername]); //aici am sters PlayerInfo[id][pJob] deoarece in loc sa ii ia numele, ii lua jobul. ii seteaza jobul la 0, si il pune unde ii gaseste numele. zimi daca ai inteles
            mysql_tquery(mysql, "szQuery");
        else return SendClientMessage(playerid, COLOR_WHITE, "You don't have a job.");
    }
    return 1;
}

 

GETJOB:

CMD:getjob(playerid, params[])
{
    new szQuery[256];
    if(IsPlayerConnected(playerid))
    {
        new sendername[25],str[256];
        GetPlayerName(playerid,sendername,sizeof(sendername));
        if(PlayerInfo[playerid][pJob] == 0)
        {
            if (GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,607.8375,-1438.1827,14.0654))
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Jobul tau este acum Detective.");
                PlayerInfo[playerid][pJob] = 1;
                mysql_format(mysql, szQuery, sizeof(szQuery), "UPDATE `users` SET `Job`='%d' WHERE `Username`='%s'", PlayerInfo[playerid][pJob], PlayerInfo[playerid][pID]);
                mysql_tquery(mysql, szQuery);


            else if (GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,359.3762,-2071.5310,10.6953))
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Jobul tau este acum Fisherman.");
                PlayerInfo[playerid][pJob] = 2;
                mysql_format(mysql, szQuery, sizeof(szQuery), "UPDATE `users` SET `Job`='%d' WHERE `Username`='%s'", PlayerInfo[playerid][pJob], PlayerInfo[playerid][pID]);
                mysql_tquery(mysql, szQuery);

                return 1;
            }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Ai deja un job, foloseste comanda /quitjob pentru a parasi job ul.");

            return 1;
        }
    }
    return 1;
}

 

SETJOB: 

CMD:setjob(playerid, params[])
{
    new szQuery[256];
    if(IsPlayerConnected(playerid))
    {
        if (PlayerInfo[playerid][pAdmin] >= 6)
        {
            new id,jobid,string[256],giveplayer[30],sendername[30];
            if(sscanf(params, "ui",id,jobid)) return SendClientMessage(playerid, 0xFFFFFFFF, "{0049FF}Syntax: {ffffff}/setjob <Name/Playerid> <Job ID>");
            {
                if(IsPlayerConnected(id))
                {
                    if(id != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(id, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerInfo[id][pJob] = jobid;
                        format(string, sizeof(string), "Admin %s has changed you job to %d.", sendername,jobid);
                        SCM(id,COLOR_LIGHTBLUE, string);
                        new str[128];
                        mysql_format(mysql, szQuery, sizeof(szQuery),"UPDATE `users` SET `Job`='%d' WHERE `Username`='%s'",  PlayerInfo[id][pJob], PlayerInfo[id][pUsername]); // aici am schimbat o chestie, WHERE `Username` atat
                        mysql_tquery(mysql, szQuery);

                        return 1;
                    }
                else
                {
                    SendClientMessage(playerid,COLOR_WHITE, "{FFFFCC}Error: Player not connected.");

                    return 1;
                }
           }
        else
        {
            SendClientMessage(playerid, COLOR_RED, AdminOnly);

            return 1;
        }
    }
    return 1;
}

 

sami spui daca ai ceva erori, nu am testat sa fiu sigur

 

  • 0
Posted

daca vrei sa-ti functioneze si quitjob  mysql_tquery(mysql, "szQuery"); transforma in  mysql_tquery(mysql, szQuery);

maxresdefault.jpg

 

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.