SA-MP Forums Archive
/v command help [SIMPLE] - 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: /v command help [SIMPLE] (/showthread.php?tid=466428)



/v command help [SIMPLE] - PabloDiCostanzo - 27.09.2013

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.


Re: /v command help [SIMPLE] - CesarLT - 27.09.2013

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.


Re: /v command help [SIMPLE] - Dragonsaurus - 27.09.2013

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;
}



Respuesta: /v command help [SIMPLE] - PabloDiCostanzo - 27.09.2013

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


Re: /v command help [SIMPLE] - Konstantinos - 27.09.2013

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


Respuesta: /v command help [SIMPLE] - PabloDiCostanzo - 28.09.2013

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)


Re: /v command help [SIMPLE] - Konstantinos - 28.09.2013

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.


Respuesta: /v command help [SIMPLE] - PabloDiCostanzo - 28.09.2013

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


Re: /v command help [SIMPLE] - Dragonsaurus - 28.09.2013

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



Respuesta: /v command help [SIMPLE] - PabloDiCostanzo - 28.09.2013

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?