SA-MP Forums Archive
Command only once? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Command only once? (/showthread.php?tid=92057)



Command only once? - Lewwy - 18.08.2009

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


Re: Command only once? - MenaceX^ - 18.08.2009

What do you mean "once"?


Re: Command only once? - Lewwy - 18.08.2009

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.


Re: Command only once? - Lewwy - 19.08.2009

BUMP.

(12 hours)