SA-MP Forums Archive
Command Not Working! [READ][BUGGED] - 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)
+--- Thread: Command Not Working! [READ][BUGGED] (/showthread.php?tid=349372)



Command Not Working! [READ][BUGGED] - Infinity90 - 08.06.2012

Can someone fix my command? when I use /v 425 or /v sultan or any vehicle ID or name, it just says HINT:/v, [Car name] then I do what it says and no vehicle spawns. Can someone fix my code please.
pawn Код:
CMD:v(playerid, params[])
{
    if(pGame[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can not use this command whilst in a mini game!");

    new String[200];
    new tmp[32];

    if(sscanf(params, "s[32]", tmp)) return SendClientMessage(playerid,COLOR_RED, "HINT /v [car name]");

    new vehicle = GetVehicleModelIDFromName(tmp);
    if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid,COLOR_RED, "That vehicle name you have given was not found, please try again!");

    if(Veh[playerid][VehId] != -1)
        DestroyVehicle(Veh[playerid][VehId]);
    new Float:x, Float:y, Float:z, Float:a;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, a);
    if(IsPlayerInAnyVehicle(playerid))
    {
        GetXYInFrontOfPlayer(playerid, x, y, 8);
    }
    else
    {
        GetXYInFrontOfPlayer(playerid, x, y, 5);
    }
    new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
    Veh[playerid][VehId] = PlayersVehicle;
    LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
    format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
    SendClientMessage(playerid,COLOR_ORANGE, String);
    return 1;
}
I Do not get any warnings or errors in the script.


Re: Command Not Working! [READ][BUGGED] - SnG.Scot_MisCuDI - 08.06.2012

EDIT: nvm


Re: Command Not Working! [READ][BUGGED] - Chris1337 - 08.06.2012

pawn Код:
CMD:v(playerid, params[])
{
    if(pGame[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can not use this command whilst in a mini game!");

    new String[200];
    new tmp[32];

    if(!sscanf(params, "s[32]", tmp)) return SendClientMessage(playerid,COLOR_RED, "HINT /v [car name]");

    new vehicle = GetVehicleModelIDFromName(tmp);
    if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid,COLOR_RED, "That vehicle name you have given was not found, please try again!");

    if(Veh[playerid][VehId] != -1)
        DestroyVehicle(Veh[playerid][VehId]);
    new Float:x, Float:y, Float:z, Float:a;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, a);
    if(IsPlayerInAnyVehicle(playerid))
    {
        GetXYInFrontOfPlayer(playerid, x, y, 8);
    }
    else
    {
        GetXYInFrontOfPlayer(playerid, x, y, 5);
    }
    new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
    Veh[playerid][VehId] = PlayersVehicle;
    LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
    format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
    SendClientMessage(playerid,COLOR_ORANGE, String);
    return 1;
}