SA-MP Forums Archive
Easy help with /vec cmd :D - 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: Easy help with /vec cmd :D (/showthread.php?tid=243625)



Easy help with /vec cmd :D - ricardo178 - 23.03.2011

Hey guys, i have done all this completly alone by my mind and now don't work.. Compile without errors/warnings but ingame i type /spawncar 560 3 3 and it don't spawn teh car, it jus show me again the usage form...

here's the code:

pawn Код:
COMMAND:spawncar(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 105)
    {
        new id, carid, carcolor1, carcolor2;
        if(!sscanf(params, "uiiii", id, carid, carcolor1, carcolor2))
        {
            if(carid >= 400 && carid <= 611)
            {
                if(carcolor1 >= 0 && carid <= 252)
                {
                    if(carcolor2 >= 0 && carid <= 252)
                    {
                        new Float:X, Float:Y, Float:Z;
                        GetPlayerPos(playerid, X, Y, Z);
                        CreateVehicle(carid, X, Y, Z+(2), 10, carcolor1, carcolor2, 100);
                        SendClientMessage(playerid, 0xFF00CC, "Vehicle Spawned");
                        return 1;
                    }
                    else return SendClientMessage(playerid, 0xFF00CC, "Only color id's between 0 and 252 are avaliable.");
                }
                else return SendClientMessage(playerid, 0xFF00CC, "Only color id's between 0 and 252 are avaliable.");
            }
            else return SendClientMessage(playerid, 0xFF00CC, "Only id's between 400 and 611 are avaliable.");
        }
        else return SendClientMessage(playerid, 0xFF00CC, "USAGE: /spawncar [VehicleId] [Color 1][Color 2]");
    }
    else return SendClientMessage(playerid, 0xFF00CC, "You are not allowed to use this command.");
}



Re: Easy help with /vec cmd :D - randomkid88 - 23.03.2011

In your command, you have the "u" param, but it is never used anywhere else. Also, you have an extra "i", so you have a total of 5 params but are only trying to use 3. Make it:
pawn Код:
sscanf(params, "iii", carid, carcolor1, carcolor2)



Re: Easy help with /vec cmd :D - ricardo178 - 23.03.2011

Thanks


Re: Easy help with /vec cmd :D - randomkid88 - 23.03.2011

Post the command again or edit the first one to the version you have now.


Re: Easy help with /vec cmd :D - ricardo178 - 23.03.2011

It still not working... Cmd here:

pawn Код:
COMMAND:spawncar(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 105)
    {
        new carid, carcolor1, carcolor2;
        if(!sscanf(params, "iii", carid, carcolor1, carcolor2))
        {
            if(carid >= 400 && carid <= 611)
            {
                if(carcolor1 >= 0 && carid <= 252)
                {
                    if(carcolor2 >= 0 && carid <= 252)
                    {
                        new Float:X, Float:Y, Float:Z;
                        GetPlayerPos(playerid, X, Y, Z);
                        CreateVehicle(carid, X, Y, Z+(2), 10, carcolor1, carcolor2, 100);
                        SendClientMessage(playerid, 0xFF00CC, "Vehicle Spawned");
                        return 1;
                    }
                    else return SendClientMessage(playerid, 0xFF00CC, "Only color id's between 0 and 252 are avaliable.");
                }
                else return SendClientMessage(playerid, 0xFF00CC, "Only color id's between 0 and 252 are avaliable.");
            }
            else return SendClientMessage(playerid, 0xFF00CC, "Only id's between 400 and 611 are avaliable.");
        }
        else return SendClientMessage(playerid, 0xFF00CC, "USAGE: /spawncar [VehicleId] [Color 1][Color 2]");
    }
    else return SendClientMessage(playerid, 0xFF00CC, "You are not allowed to use this command.");
}



Re: Easy help with /vec cmd :D - randomkid88 - 23.03.2011

What are the errors?


Re: Easy help with /vec cmd :D - ricardo178 - 23.03.2011

Working now, thanks, it was a mistake on this lines:

pawn Код:
if(carcolor1 >= 0 && carcolor1 <= 252)