Problem with /car
#1

What's wrong with this command, when I spawn a car, I crash :S.


pawn Код:
dcmd_car(playerid, cmdtext[])
{
    new string[128];
    new Float:X, Float:Y, Float:Z, Float:Angle;
    new tmp[256], idx;
    tmp = strtok(cmdtext, idx);
    new car;
    car = strval(tmp);
    if(!strlen(tmp))
    {
      SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /car [VEHICLEID]");
      return 1;
    }
    else
    {
         if(car < 400 || car > 611)
         {
        SendClientMessage(playerid, COLOR_WARN, "Wrong VEHICLEID.");
      }
    }
    GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
    GetPlayerFacingAngle(playerid, Float:Angle);
    CreateVehicle(car, Float:X, Float:Y, Float:Z + 2.0, Float:Angle + 90.0, -1, -1, 5000);
    format(string, sizeof(string), "You have created a vehicle:(VEHICLEID: %d)", cmdtext);
    SendClientMessage(playerid, COLOR_GREEN, string);
    SendClientMessage(playerid, COLOR_WHITE, "Delete your vehicle after using.");
    return 1;
}
Reply
#2

Replace

CreateVehicle(car, Float:X, Float:Y, Float:Z + 2.0, Float:Angle + 90.0, -1, -1, 5000);

with

CreateVehicle(car, X, Y, Z + 2.0, Angle + 90.0, -1, -1, 5000);
Reply
#3

should return 1 after send error message
Reply
#4

Use

return SendClientMessage(...)
Reply
#5

Both're OK XD
Reply
#6

Thank you Mikep .
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)