SA-MP Forums Archive
Problem with /car - 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: Problem with /car (/showthread.php?tid=70498)



Problem with /car - Sync - 25.03.2009

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;
}



Re: Problem with /car - Mikep - 25.03.2009

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);


Re: Problem with /car - yezizhu - 25.03.2009

should return 1 after send error message


Re: Problem with /car - Mikep - 25.03.2009

Use

return SendClientMessage(...)


Re: Problem with /car - yezizhu - 25.03.2009

Both're OK XD


Re: Problem with /car - Sync - 25.03.2009

Thank you Mikep .