21.11.2014, 13:59
Hi all today i try to make a capture system where for start capture yuo need to enter a pickup and start capture but i want change it to if a player enter in pickup and exit to it and capture ins't finish the capture will stop
i hope its right to all what i try to make thx for all help
public OnPlayerPickUpPickup(playerid, pickupid)
{
if (pickupid == captureballas) // ballas capture
{
SendClientMessage(playerid,0x0000FF96," The capture will finish in 20 seconds");
KillTimer(MyTimer[playerid]);
if(GetPlayerTeam(playerid) == 0) GangZoneFlashForAll(ballasga,0x00800096);
if(GetPlayerTeam(playerid) == 1) GangZoneFlashForAll(ballasga,0x0000FF96);
if(GetPlayerTeam(playerid) == 2) GangZoneFlashForAll(ballasga,0xFFFF0096);
if(GetPlayerTeam(playerid) == 3) GangZoneFlashForAll(ballasga,0x93116F96);
MyTimer[playerid] = SetTimerEx("TestFunction", 1000, 1, "i", playerid);
}
else if (pickupid == capturegrove) // grove capture
{
SendClientMessage(playerid,0x0000FF96," The capture will finish in 20 seconds");
KillTimer(mytime[playerid]);
if(GetPlayerTeam(playerid) == 0) GangZoneFlashForAll(grove,0x00800096);
if(GetPlayerTeam(playerid) == 1) GangZoneFlashForAll(grove,0x0000FF96);
if(GetPlayerTeam(playerid) == 2) GangZoneFlashForAll(grove,0xFFFF0096);
if(GetPlayerTeam(playerid) == 3) GangZoneFlashForAll(grove,0x93116F96);
mytime[playerid] = SetTimerEx("testshit", 1000, 1, "i", playerid);
}
else if (pickupid == capturevagos) // vagos capture
{
SendClientMessage(playerid,0x0000FF96," The capture will finish in 20 seconds");
if(GetPlayerTeam(playerid) == 0) GangZoneFlashForAll(vagos,0x00800096);
if(GetPlayerTeam(playerid) == 1) GangZoneFlashForAll(vagos,0x0000FF96);
if(GetPlayerTeam(playerid) == 2) GangZoneFlashForAll(vagos,0xFFFF0096);
if(GetPlayerTeam(playerid) == 3) GangZoneFlashForAll(vagos,0x93116F96);
KillTimer(mytimes[playerid]);
mytimes[playerid] = SetTimerEx("testvagos", 1000, 1, "i", playerid);
}
else if (pickupid == capturemafia) // vagos capture
{
SendClientMessage(playerid,0x0000FF96," The capture will finish in 20 seconds");
if(GetPlayerTeam(playerid) == 2) SendClientMessage(playerid, 0xfff00, "{ff0000}Your gang is under attack !!!");
if(GetPlayerTeam(playerid) == 0) GangZoneFlashForAll(MAFIAga,0x00800096);
if(GetPlayerTeam(playerid) == 1) GangZoneFlashForAll(MAFIAga,0x0000FF96);
if(GetPlayerTeam(playerid) == 2) GangZoneFlashForAll(MAFIAga,0xFFFF0096);
if(GetPlayerTeam(playerid) == 3) GangZoneFlashForAll(MAFIAga,0x93116F96);
KillTimer(mytimers[playerid]);
mytimers[playerid] = SetTimerEx("TestCapture", 1000, 1, "i", playerid);
}
else if(pickupid == Star)
{
new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "~r~%s has won the event.", name);
GameTextForAll(string, 7000, 1);
SendClientMessage(playerid,0xff000, "{FF0000}You got {FFFF00}5000 {0066CC}$");
GivePlayerMoney(playerid, 5000);
DestroyPickup(Star);
}
return 1;
}
i hope its right to all what i try to make thx for all help
public OnPlayerPickUpPickup(playerid, pickupid)
{
if (pickupid == captureballas) // ballas capture
{
SendClientMessage(playerid,0x0000FF96," The capture will finish in 20 seconds");
KillTimer(MyTimer[playerid]);
if(GetPlayerTeam(playerid) == 0) GangZoneFlashForAll(ballasga,0x00800096);
if(GetPlayerTeam(playerid) == 1) GangZoneFlashForAll(ballasga,0x0000FF96);
if(GetPlayerTeam(playerid) == 2) GangZoneFlashForAll(ballasga,0xFFFF0096);
if(GetPlayerTeam(playerid) == 3) GangZoneFlashForAll(ballasga,0x93116F96);
MyTimer[playerid] = SetTimerEx("TestFunction", 1000, 1, "i", playerid);
}
else if (pickupid == capturegrove) // grove capture
{
SendClientMessage(playerid,0x0000FF96," The capture will finish in 20 seconds");
KillTimer(mytime[playerid]);
if(GetPlayerTeam(playerid) == 0) GangZoneFlashForAll(grove,0x00800096);
if(GetPlayerTeam(playerid) == 1) GangZoneFlashForAll(grove,0x0000FF96);
if(GetPlayerTeam(playerid) == 2) GangZoneFlashForAll(grove,0xFFFF0096);
if(GetPlayerTeam(playerid) == 3) GangZoneFlashForAll(grove,0x93116F96);
mytime[playerid] = SetTimerEx("testshit", 1000, 1, "i", playerid);
}
else if (pickupid == capturevagos) // vagos capture
{
SendClientMessage(playerid,0x0000FF96," The capture will finish in 20 seconds");
if(GetPlayerTeam(playerid) == 0) GangZoneFlashForAll(vagos,0x00800096);
if(GetPlayerTeam(playerid) == 1) GangZoneFlashForAll(vagos,0x0000FF96);
if(GetPlayerTeam(playerid) == 2) GangZoneFlashForAll(vagos,0xFFFF0096);
if(GetPlayerTeam(playerid) == 3) GangZoneFlashForAll(vagos,0x93116F96);
KillTimer(mytimes[playerid]);
mytimes[playerid] = SetTimerEx("testvagos", 1000, 1, "i", playerid);
}
else if (pickupid == capturemafia) // vagos capture
{
SendClientMessage(playerid,0x0000FF96," The capture will finish in 20 seconds");
if(GetPlayerTeam(playerid) == 2) SendClientMessage(playerid, 0xfff00, "{ff0000}Your gang is under attack !!!");
if(GetPlayerTeam(playerid) == 0) GangZoneFlashForAll(MAFIAga,0x00800096);
if(GetPlayerTeam(playerid) == 1) GangZoneFlashForAll(MAFIAga,0x0000FF96);
if(GetPlayerTeam(playerid) == 2) GangZoneFlashForAll(MAFIAga,0xFFFF0096);
if(GetPlayerTeam(playerid) == 3) GangZoneFlashForAll(MAFIAga,0x93116F96);
KillTimer(mytimers[playerid]);
mytimers[playerid] = SetTimerEx("TestCapture", 1000, 1, "i", playerid);
}
else if(pickupid == Star)
{
new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "~r~%s has won the event.", name);
GameTextForAll(string, 7000, 1);
SendClientMessage(playerid,0xff000, "{FF0000}You got {FFFF00}5000 {0066CC}$");
GivePlayerMoney(playerid, 5000);
DestroyPickup(Star);
}
return 1;
}