Vehicle Change on the Spot
#4

Can somebody please help me out with this? Heres the code that I'm using right now:

pawn Код:
if(strcmp(cmd, "/vch", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] <= 2)
            {
                SendClientMessage(playerid, COLOR_RED, " [ERROR:] You are not authorized to use that command!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /vch [carid]");
                return 1;
            }
            new id;
            if(id < 1 || id > 611)
            {
            SendClientMessage(playerid, COLOR_RED, " [ERROR:] Vehicle Number can't be below 400 or above 611!");
            return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /vch [carid]");
                return 1;
            }
            new cid = GetPlayerVehicleID(playerid);
            new Float:x, Float:y, Float:z, Float:a,
            Float:vX, Float:vY, Float:vZ;
            GetVehiclePos(cid, x, y, z);
            GetVehicleZAngle(cid, a);
            DestroyVehicle(cid);
            new nid = CreateVehicle(id, x, y, z, a, -1, -1, -1);
            PutPlayerInVehicle(playerid, nid, 0);
            SetVehicleVelocity(nid, vX, vY, vZ);
            format(string, sizeof(string), "[SERVER:] Your vehicle has been successfully changed. Vehicle ID:%d", nid);
            SendClientMessage(playerid, COLOR_GREEN, string);
        }
        return 1;
    }
It compiles fine, but when I do the command in game, the car just disappears. I do get the whole "Your vehicle has been changed" thing, but the vehicle just disappears. So can somebody please tell me what I'm doing wrong here, and how I can fix it.
Reply


Messages In This Thread
Vehicle Change on the Spot - by scripter1 - 15.08.2010, 02:41
Re: Vehicle Change on the Spot - by Daren_Jacobson - 15.08.2010, 03:13
Re: Vehicle Change on the Spot - by scripter1 - 15.08.2010, 22:03
Re: Vehicle Change on the Spot - by scripter1 - 27.08.2010, 20:47
Re: Vehicle Change on the Spot - by playbox12 - 27.08.2010, 21:03
Re: Vehicle Change on the Spot - by Mike_Peterson - 27.08.2010, 21:08
Re: Vehicle Change on the Spot - by Adil - 27.08.2010, 21:50
Re: Vehicle Change on the Spot - by scripter1 - 28.08.2010, 19:21

Forum Jump:


Users browsing this thread: 2 Guest(s)