Easy help with /vec cmd :D
#1

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.");
}
Reply
#2

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)
Reply
#3

Thanks
Reply
#4

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

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.");
}
Reply
#6

What are the errors?
Reply
#7

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

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


Forum Jump:


Users browsing this thread: 3 Guest(s)