Command /spawnbike problem
#1

Hello. I have a problem. If a player use /spawnbike, this command destroy bike from another player.
Ex:
Me: /spawnbike - Spawning a bike
My friend:/spawnbike - My bike has been destroyed, -Spawning a bike.

How i can repair this command to spawn my bike and don't destroy another bike i i use again, destroy only my bike.
Quote:

new vbike[MAX_PLAYERS];

Quote:

CMD: spawnbike(playerid, params[]) {
if(IsPlayerInRangeOfPoint(playerid, 2, 1670.1096, -1697.3649, 15.1642)) {
if(vbike[playerid] == 0) {
vbike[playerid] = AddStaticVehicleEx(509, 1670.1096, -1697.3649, 15.1642, -93.3600, 1, 1, 10, -1);
PutPlayerInVehicle(playerid, vbike[playerid], -1);
SendClientMessage(playerid, COLOR_WHITE, "Ai spawnat un bike!");
vbike[playerid] = 1;
}
else {
DestroyVehicle(vbike[playerid]);
vbike[playerid] = 0;
SendClientMessage(playerid, COLOR_WHITE, "Aveai deja un vehicul {00ff00}spawnat{ffffff}.");
SendClientMessage(playerid, COLOR_WHITE, "Din fericire a fost {00ff00}despawnat{ffffff}.");
SendClientMessage(playerid, COLOR_WHITE, "Foloseste {00ff00}/spawnbike {ffffff}din nou pentru a spawna alt {00ff00}BIKE{ffffff}.");
}
}
return 1;
}

P.S : Sorry for bad english
Reply
#2

it happend with me too, try this

pawn Код:
new vbike[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    vbike[playerid] = 0;
    return 1;
}

CMD:spawnbike(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 2, 1670.1096, -1697.3649, 15.1642))
    {
        if(vbike[playerid] != 0)
        {
            vbike[playerid] = AddStaticVehicleEx(509, 1670.1096, -1697.3649, 15.1642, -93.3600, 1, 1, 10, -1);
            PutPlayerInVehicle(playerid, vbike[playerid], 0);
            SendClientMessage(playerid, COLOR_WHITE, "Ai spawnat un bike!");
        }
        else
        {
            DestroyVehicle(vbike[playerid]);
            vbike[playerid] = 0;
            SendClientMessage(playerid, COLOR_WHITE, "Aveai deja un vehicul {00ff00}spawnat{ffffff}.");
            SendClientMessage(playerid, COLOR_WHITE, "Din fericire a fost {00ff00}despawnat{ffffff}.");
            SendClientMessage(playerid, COLOR_WHITE, "Foloseste {00ff00}/spawnbike {ffffff}din nou pentru a spawna alt {00ff00}BIKE{ffffff}.");
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by ReD_HunTeR
Посмотреть сообщение
it happend with me too, try this

pawn Код:
new vbike[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    vbike[playerid] = 0;
    return 1;
}

CMD:spawnbike(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 2, 1670.1096, -1697.3649, 15.1642))
    {
        if(vbike[playerid] != 0)
        {
            vbike[playerid] = AddStaticVehicleEx(509, 1670.1096, -1697.3649, 15.1642, -93.3600, 1, 1, 10, -1);
            PutPlayerInVehicle(playerid, vbike[playerid], 0);
            SendClientMessage(playerid, COLOR_WHITE, "Ai spawnat un bike!");
        }
        else
        {
            DestroyVehicle(vbike[playerid]);
            vbike[playerid] = 0;
            SendClientMessage(playerid, COLOR_WHITE, "Aveai deja un vehicul {00ff00}spawnat{ffffff}.");
            SendClientMessage(playerid, COLOR_WHITE, "Din fericire a fost {00ff00}despawnat{ffffff}.");
            SendClientMessage(playerid, COLOR_WHITE, "Foloseste {00ff00}/spawnbike {ffffff}din nou pentru a spawna alt {00ff00}BIKE{ffffff}.");
        }
    }
    return 1;
}
Thank you. It worked mostly as if to [ if(vbike [playerid] != 0) ] we put = instead of ! and it worked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)