Jump to content

Problema comanda


AlexanderSMG

Recommended Posts

Salut am comanda asta /editcarmodel,o compliez fara nicio problema,intru pe server,si cand stau intr-o masina si execut comanda imi scrie Car model id x is now id 411 asta fiind infernus,si imi spameaza chatu cu textul asta pana mi se inchide conexiunea la server,nu pica serverul,mi se blocheaza mie sampu. Serverul ramane on.

Comanda: 

}
    if(strcmp(cmd, "/editcarmodel", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 4)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   Nu esti Admin !");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /editcarmodel [modelid]");
                return 1;
            }
            new proplev = strval(tmp);
            for(new i = 0; i < sizeof(CarInfo); i++)
            {
                if(IsAnOwnableCar(idcar))
                {
                    CarInfo[idcar][cModel] = proplev;
                    format(string, sizeof(string), "Car: %d is now %d",idcar,CarInfo[idcar][cModel]);
                    SendClientMessage(playerid, COLOR_GRAD2, string);
                    OnPropUpdate();
                }
            }
        }
        return 1;
    }

  • Upvote 1
Link to comment
Share on other sites

 

ia incearca asa.

 if(strcmp(cmd, "/editcarmodel", true) == 0)
    {

            new proplev = strval(tmp);
            for(new i = 0; i < sizeof(CarInfo); i++)
            if(PlayerInfo[playerid][pAdmin] >= 5)
            {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))

           {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /editcarmodel [modelid]");
                return 1;
                if(IsAnOwnableCar(idcar))
                {
                    CarInfo[idcar][cModel] = proplev;
                    format(string, sizeof(string), "Car: %d is now %d",idcar,CarInfo[idcar][cModel]);
                    SendClientMessage(playerid, COLOR_GRAD2, string);
                    OnPropUpdate();

                  return 0;
                }
            }
        }

       else return SendClientMessage(playerid, COLOR_GRAD2, "Nu esti admin.");
        return 1;
    }

Edited by Alberto.
Link to comment
Share on other sites

am analizat mai bine comanda. Cred ca ar fii necesar doar sa ii pui un return atunci cand iti arata acel text

Comanda: 

}
    if(strcmp(cmd, "/editcarmodel", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 4)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   Nu esti Admin !");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /editcarmodel [modelid]");
                return 1;
            }
            new proplev = strval(tmp);
            for(new i = 0; i < sizeof(CarInfo); i++)
            {
                if(IsAnOwnableCar(idcar))
                {
                    CarInfo[idcar][cModel] = proplev;
                    format(string, sizeof(string), "Car: %d is now %d",idcar,CarInfo[idcar][cModel]);
                    SendClientMessage(playerid, COLOR_GRAD2, string);
                    OnPropUpdate();

                  return 1; // asta am adaugat 
                }
            }
        }
        return 1;
    }

Link to comment
Share on other sites

Acum merge,doar ca trebuie sa dau restart la server pentru a se transforma masina in ce vreau. Adica eu /editcarmodel la un Elegy sa se faca infernus,imi scrie Car id 323 is now model 411 dar abia dupa ce dau restart la server se transforma,nu se poate face ceva?

Edited by AlexanderSMG
Link to comment
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   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.