07.06.2017, 11:07
What I wanted to do is player writes /activate they get 4 walls and each zombie approaching gets cherried by the walls every 3 seconds for 9 seconds but Im running into bugs: either objects doesnt get destroyed either the cherry thing never stops even when I kill the timer lol
yeah I know the code is badly written , I wrote it quickly zz ;(
Код:
CMD:activate(playerid) { new Float:x,Float:y,Float:z; // Get Player Coordinate { if(pInfo[playerid][HasCherryPerk] == 1) { if(maptime <= 120) // If Map Time is less than 120 seconds (2 Minutes) { GetPlayerPos(playerid,Float:x,Float:y,Float:z); // Get Player Position if(team[playerid] == TEAM_HUMAN)// if team is Human { fucktimer[playerid] = SetTimerEx("GetCherried", 3000, false, "i", playerid); CageHuman = CreateObject(971, Float:x+4.0,Float:y+4.0,Float:z+0.0, 0.0, 0.0, 0.0); CageHuman1 = CreateObject(971, Float:x+4.0,Float:y-4.0,Float:z-0.0, 0.0, 0.0, 0.0); CageHuman2 = CreateObject(971, Float:x-1.0,Float:y+0.0,Float:z-0.0, 0.0, 0.0, 90.0); CageHuman3 = CreateObject(971, Float:x+8.0,Float:y+0.0,Float:z-0.0, 0.0, 0.0, 90.0); CageHuman4 = CreateObject(971, Float:x+4.0,Float:y+0.0,Float:z+3.0, 90.0, 0.0, 0.0); uselesstimer[playerid] = SetTimerEx("HideObject971", 9000, false, "i", playerid); } } } } return 1; } forward GetCherried(playerid); public GetCherried(playerid) { new Float:x,Float:y,Float:z,Float:Angle; GetPlayerPos(playerid,Float:x,Float:y,Float:z); GetPlayerFacingAngle(playerid,Float:Angle); foreach(Player,i) { if(team[i] == TEAM_ZOMBIE) { if(GetDistanceBetweenPlayers(playerid,i) < 15.0) { GetClosestPlayer(i); GetPlayerFacingAngle(i,Float:Angle); GetPlayerVelocity(i,Float:x,Float:y,Float:z); SetPlayerVelocity(i,Float:x+0.3,Float:y+0.3,Float:z+0.2); SetPlayerFacingAngle(i,Float:Angle); } } } return 1; } forward HideObject971(playerid); public HideObject971(playerid) { DestroyObject(CageHuman); DestroyObject(CageHuman1); DestroyObject(CageHuman2); DestroyObject(CageHuman3); DestroyObject(CageHuman4); KillTimer(fucktimer[playerid]); return 1; }