08.06.2017, 05:07
I just spent ages writing a massive post and it said my token had expired because I left the page open too long... so I'm just going to spit some code at you and let you figure it out.
Haven't tested, have fun, cya, bye.
PHP код:
new CherryCount[MAX_PLAYERS];
new CageHuman[MAX_PLAYERS][5] = {INVALID_OBJECT_ID, ...};
CMD:activate(playerid)
{
if(pInfo[playerid][HasCherryPerk] == 1)
{
if(maptime <= 120) // If Map Time is less than 120 seconds (2 Minutes)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, Float:x, Float:y, Float:z); // Get Player Position
if(team[playerid] == TEAM_HUMAN)// if team is Human
{
if(CherryCount[playerid]++ != 0) return SendClientMessage(playerid, -1, "You have already enabled this perk.");
SetTimerEx("GetCherried", 3000, false, "i", playerid);
CageHuman[playerid][0] = CreateObject(971, Float:x + 4.0, Float:y + 4.0, Float:z, 0.0, 0.0, 0.0);
CageHuman[playerid][1] = CreateObject(971, Float:x + 4.0, Float:y - 4.0, Float:z, 0.0, 0.0, 0.0);
CageHuman[playerid][2] = CreateObject(971, Float:x - 1.0, Float:y, Float:z, 0.0, 0.0, 90.0);
CageHuman[playerid][3] = CreateObject(971, Float:x + 8.0, Float:y, Float:z, 0.0, 0.0, 90.0);
CageHuman[playerid][4] = CreateObject(971, Float:x + 4.0, Float:y, Float:z + 3.0, 90.0, 0.0, 0.0);
}
// else SendClientMessage(playerid, -1, "Only Humans can use this perk.");
}
// else SendClientMessage(playerid, -1, "Map Time is more than 120 seconds.");
}
// else SendClientMessage(playerid, -1, "You don't have the Cherry perk.");
return 1;
}
forward GetCherried(playerid);
public GetCherried(playerid)
{
new Float:x, Float:y, Float:z;
foreach(new i : Player)
{
if(i == playerid || team[i] != TEAM_ZOMBIE) continue;
if(GetDistanceBetweenPlayers(playerid, i) < 15.0)
{
GetPlayerVelocity(i, Float:x, Float:y, Float:z);
SetPlayerVelocity(i, Float:x + 0.3, Float:y + 0.3, Float:z + 0.2);
}
}
if(!IsPlayerConnected(playerid) || ++CherryCount[playerid] > 3)
{
for(new j = 0; j < sizeof(CageHuman[]); j++)
{
DestroyObject(CageHuman[playerid][j]);
CageHuman[playerid][j] = INVALID_OBJECT_ID;
}
CherryCount[playerid] = 0;
return 1;
}
else SetTimerEx("GetCherried", 3000, false, "i", playerid);
return 1;
}