For a single player
#1

Код:
CMD:balloon(playerid,params[])
{
	if(PlayerInfo[playerid][pVip] == 0) return 0;
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid, x, y, z);
    DestroyObject(Balloon);
    DestroyObject(Fire);
    DestroyObject(Fire1);
    PlayerIn[playerid][BalloonPlayer] = 0;
    Balloon = CreateObject(19335, x, y, z+3,   0.00, 0.00, 0.00);
    Fire = CreateObject(18692, 0,0,0,   0.00, 0.00, 0.00);
    Fire1 = CreateObject(18692, 0,0,0,   0.00, 0.00, 0.00);
    AttachObjectToObject(Fire, Balloon, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 1);
    AttachObjectToObject(Fire1, Balloon, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 1);
    SetPlayerPos(playerid,x,y,z+3.5);
    SendClientMessage(playerid,COLOR_GREENZ,"Press the following keys to control the hot air balloon");
    SendClientMessage(playerid,COLOR_GREENZ,"~k~~PED_SPRINT~+~k~~CONVERSATION_YES~ (Move Balloon Up)");
    SendClientMessage(playerid,COLOR_GREENZ,"~k~~PED_SPRINT~+~k~~CONVERSATION_NO~ (Move Balloon Down)");
    SendClientMessage(playerid,COLOR_GREENZ,"~k~~VEHICLE_ENTER_EXIT~+~k~~CONVERSATION_YES~ (Move Balloon Forward)");
    SendClientMessage(playerid,COLOR_GREENZ,"~k~~VEHICLE_ENTER_EXIT~+~k~~CONVERSATION_NO~ (Move Balloon Back)");
    SendClientMessage(playerid,COLOR_GREENZ,"~k~~SNEAK_ABOUT~+~k~~CONVERSATION_NO~ (Move Balloon Left)");
    SendClientMessage(playerid,COLOR_GREENZ,"~k~~SNEAK_ABOUT~+~k~~CONVERSATION_YES~ (Move Balloon Right)");
    PlayerIn[playerid][BalloonPlayer] = 1;
    return 1;
}
I have a balloon command but i thought that if i use the delete command below so it will delete the spawned balloons of any other player


Код:
CMD:destroyballoon(playerid,params[])
{
	if(PlayerIn[playerid][BalloonPlayer] == 0) return GameTextForPlayer(playerid,"~g~you dident spawned any balloon",4500,3);
    DestroyObject(Balloon);
    DestroyObject(Fire);
    DestroyObject(Fire1);
    PlayerIn[playerid][BalloonPlayer] = 0;
    return 1;
}
How can i fix it?
Reply
#2

Make it in a player array. Here's an example:

pawn Код:
new Balloon[MAX_PLAYERS]; // Place this on global scope
Balloon[playerid] = CreateObject(19335, x, y, z+3,   0.00, 0.00, 0.00); // Create the object and assign object ID
DestroyObject(Balloon[playerid]); // When you wanna delete the object you only delete the one that is assigned to this player
You should do the same to Fire and Fire1.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)