SA-MP Forums Archive
cmd problem - 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: cmd problem (/showthread.php?tid=181873)



cmd problem - WillyP - 07.10.2010

heres my command:

pawn Код:
dcmd_veh(playerid,params[])
{
    #pragma unused params
    new String[200];
    new tmp[256];
    new Float:x, Float:y, Float:z;
    new vehicle = GetVehicleModelIDFromName(tmp);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USAGE : /vehicle [Vehicle name]");
    if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, COLOR_RED, "ERROR : That vehicle name was not found");
    new Float:a;
    GetPlayerFacingAngle(playerid, a);
    GetPlayerPos(playerid, x, y, z);
    if(IsPlayerInAnyVehicle(playerid) == 1)
    {
        GetXYInFrontOfPlayer(playerid, x, y, 8);
    }
    else
    {
        GetXYInFrontOfPlayer(playerid, x, y, 5);
    }
    new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
    LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
    PutPlayerInVehicle(playerid, PlayersVehicle, 0);
    format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
    SendClientMessage(playerid, COLOR_LIGHTGREEN, String);
    return 1;
}
except, it either doesnt spawn a car, or unknown command appears.

ive edited it loads of times to try to get it to work, but it doesnt :/

any help plox?