08.06.2016, 02:13
Well, I need help in this code, This code is literally made for a sniper class. But when i type /tower it builds the tower.
And it's supposed from the code when i type /tower again, it will remove the tower and send me down.
But nope, instead it builds another tower ontop of the first one.. :/
And it's supposed from the code when i type /tower again, it will remove the tower and send me down.
But nope, instead it builds another tower ontop of the first one.. :/
Код:
CMD:tower(playerid,params[])
{
new bool:objectz,tower,Float:x,Float:y,Float:z;
if(objectz == false)
{
GetPlayerPos(playerid, x, y, z);
tower = CreateObject(11461,x,y,z, 0.0, 0.0, 96.0);
SetPlayerPos(playerid, x, y, z + 27.0);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have created a tower.");
objectz = true;
}
else if(objectz == true)
{
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid,x,y,z - 27.0);
DestroyObject(tower);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have destroyed a tower.");
objectz = false;
}
return 1;
}

