/v command help [SIMPLE]
#1

Greetings,


Today I was making a /v command for administrators, but when I complie it I get this errors:

pawn Код:
C:\Users\usuario\Sa-Mp\filterscripts\sql&cmd.pwn(1097) : error 029: invalid expression, assumed zero
C:\Users\usuario\Sa-Mp\filterscripts\sql&cmd.pwn(1097) : error 001: expected token: ";", but found "if"
Andthis is my code:

pawn Код:
new vCar[MAX_PLAYERS];
CMD:v(playerid, params[])
{
    if(gPlayerInfo[playerid][pAdmin] >= 1)
    {
        new vid;
        if(sscanf(params, "i", vid)) return SendClientMessage(playerid, -1, "{878787}USAGE: /v [id(400 - 611)]");
        {
            else if (vid < 400 || vid > 611) return SendClientMessage(playerid, -1, "{FF0000}ERROR: Invalid veichle id"); //THIS LINE
            else
            {
                if(vCar[playerid] != -1)
                {
                    DestroyVehicle(vCar[playerid]);
                }
                new Float:x, Float:y, Float:z;
                GetPlayerPos(playerid, x, y, z);
                vCar[playerid] = CreateVehicle(vid, x + 3, y, z, 0, 0,0, -1);
                SendClientMessage(playerid, COL_ORANGE, "SERVER: The server has spawned a car for you");
            }
        }
    }
    return 1;
}
If anyone can help me.

Regards,
Pablo.
Reply
#2

I am not sure, but try that..

pawn Код:
new vCar[MAX_PLAYERS];
CMD:v(playerid, params[])
{
    if(gPlayerInfo[playerid][pAdmin] >= 1)
    {
        new vid;
        if(sscanf(params, "i", vid)) return SendClientMessage(playerid, -1, "{878787}USAGE: /v [id(400 - 611)]");
        {
            if (vid < 400 || vid > 611) return SendClientMessage(playerid, -1, "{FF0000}ERROR: Invalid veichle id"); //THIS LINE
            else
            {
                if(vCar[playerid] != -1)
                {
                    DestroyVehicle(vCar[playerid]);
                }
                new Float:x, Float:y, Float:z;
                GetPlayerPos(playerid, x, y, z);
                vCar[playerid] = CreateVehicle(vid, x + 3, y, z, 0, 0,0, -1);
                SendClientMessage(playerid, COL_ORANGE, "SERVER: The server has spawned a car for you");
            }
        }
    }
    return 1;
}
Hope that will do.
Reply
#3

pawn Код:
new vCar[MAX_PLAYERS];
CMD:v(playerid, params[])
{
    if(gPlayerInfo[playerid][pAdmin] >= 1)
    {
        new vid;
        if(sscanf(params, "i", vid)) return SendClientMessage(playerid, -1, "{878787}USAGE: /v [id(400 - 611)]");
        else
        {
            if (vid < 400 || vid > 611) return SendClientMessage(playerid, -1, "{FF0000}ERROR: Invalid veichle id"); //THIS LINE
            else
            {
                if(vCar[playerid] != -1)
                {
                    DestroyVehicle(vCar[playerid]);
                }
                new Float:x, Float:y, Float:z;
                GetPlayerPos(playerid, x, y, z);
                vCar[playerid] = CreateVehicle(vid, x + 3, y, z, 0, 0,0, -1);
                SendClientMessage(playerid, COL_ORANGE, "SERVER: The server has spawned a car for you");
            }
        }
    }
    return 1;
}
Reply
#4

I have a question, why when the cars destroy. It`s re-spawn in the same place I sapwned it?
Reply
#5

That's how it was made. It respawns at the position the vehicle was created.
Reply
#6

But I want, when the car it`s already spawned and it destroys I don`t want it to re-spawn it again (without use the cmd)
Reply
#7

If you use the function DestroyVehicle, then the vehicles is destroyed; however, if the vehicles just dies (health under 250 or inside water), it will re-spawn.
Reply
#8

And it is it any way to don`t re-spawn it?
Reply
#9

pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
    DestroyVehicle(vehicleid);
    return 1;
}
Reply
#10

Adding that, why for example. When someone (adminb) type /v , and other admin type /v one of the cars (first who used /v) dissapear and it appears for the second admin?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)