Command only once?
#1

Why can I only use this command once? I'm using a friend's script;

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128];
    new tmp[128];
    new idx;
    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/setvehmodel", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, 0xFF4040FF, "USAGE: /setvehmodel [MODELID]");
            return 1;
        }
        if(PlayerInfo[playerid][pAdmin] == 10)
        {
            new thecar = strval(tmp);
            if(IsPlayerInAnyVehicle(playerid))
            {
                if(thecar > 399 && thecar < 612)
                {
                    new car = GetPlayerVehicleID(playerid) - 1;
                    new vehicleid = GetPlayerVehicleID(playerid);
                    DynamicVehicles[car][CarModel] = thecar;
                    format(string, sizeof(string), "SUCCESS: VEHICLEID %d's model is now MODELID: %d.", vehicleid, thecar);
                    SendClientMessage(playerid, 0x33FF33AA, string);
                    new Float:cx,Float:cy,Float:cz;
                    GetVehiclePos(vehicleid,cx,cy,cz);
                    new Float:angle;
                    GetVehicleZAngle(vehicleid, angle);
                    DestroyVehicle(vehicleid);
                    CreateVehicle(DynamicVehicles[car][CarModel], DynamicVehicles[car][CarX], DynamicVehicles[car][CarY], DynamicVehicles[car][CarZ], DynamicVehicles[car][CarAngle], DynamicVehicles[car][CarColor1], DynamicVehicles[car][CarColor2], -1);
                    PutPlayerInVehicle(playerid,vehicleid,0);
                    SetVehiclePos(vehicleid, cx, cy, cz);
                    SetVehicleZAngle(vehicleid, angle);
                    SaveDynamicVehicles();
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, 0xFF4040FF, "ERROR: Invalid MODELID, valid ones range from 400-611");
                }
            }
            else
            {
                SendClientMessage(playerid, 0xFF4040FF, "ERROR: You are not in a vehicle");
            }
        }
        else
        {
            SendClientMessage(playerid, 0xFF4040FF, "ERROR: You must be master admin to use /setvehmodel");
        }
        return 1;
    }
    return 0;
}
EDIT: If I shorten /setvehmodel to /model it works all the time..
Reply
#2

What do you mean "once"?
Reply
#3

When I type /setvehmodel, it comes up: USAGE: /setvehmodel [MODELID], if I type the exact same thing again, I get unknown command. Same if I put a modelid after /setvehmodel too.
Reply
#4

BUMP.

(12 hours)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)