12.11.2009, 18:19
Code:
#include <a_samp> #define gang_exemplo 0 #define gang_outro 1 #define COR_RED 0x0000CDFF forward funcaogz(playerid); forward dominou(playerid); new gang[MAX_PLAYERS]; new GZ; public OnGameModeInit() { GZ = GangZoneCreate(2045,079, -1148,917, 2284,658, -967,3207); return 1; } public OnPlayerConnect(playerid) { GangZoneShowForPlayer(playerid, GZ, 0x00000096); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/Dominar", cmdtext, true, 10) == 0) { SetTimerEx("funcaogz", 1000, 0,"e",playerid); return 1; } public funcaogz(playerid) { if(IsPlayerInArea(playerid,2045,079, -1148,917, 2284,658, -967,3207)) { if(gang[playerid] == gang_exemplo) { format(string,sizeof(string),"(Aviso) %s e a a gang exemplo estгo dominando o GZ taltal",name); SendClientMessageToAll(COR_RED,string); GangZoneFlashForAll(GZ,GetPlayerColor(playerid)); SetTimerEx("dominou", 30000, 0,"e",playerid); } if(gang[playerid] == gang_outro) { format(string,sizeof(string),"(Aviso) %s e a a gang outro estгo dominando o GZ taltal",name); SendClientMessageToAll(COR_RED,string); GangZoneFlashForAll(GZ,GetPlayerColor(playerid)); SetTimerEx("dominou", 30000, 0,"e",playerid); } } return 1; } public dominou(playerid) { if(gang[playerid] == gang_exemplo) { format(string,sizeof(string),"(Aviso) %s e a a gang exemplo dominaram a GZ taltal",name); SendClientMessageToAll(COR_RED,string); GangZoneStopFlashForAll(GZ); GangZoneHideForAll(GZ); GangZoneShowForAll(GZ,GetPlayerColor(playerid)); } if(gang[playerid] == gang_outro) { format(string,sizeof(string),"(Aviso) %s e a a gang outro dominaram o GZ taltal",name); SendClientMessageToAll(COR_RED,string); GangZoneStopFlashForAll(GZ); GangZoneHideForAll(GZ); GangZoneShowForAll(GZ,GetPlayerColor(playerid)); } return 1; } stock strtok(const string[], &index,seperator=' ') { new length = strlen(string); new offset = index; new result[255]; while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; if ((index < length) && (string[index] == seperator)) { index++; } return result; } stock IsPlayerInArea(playerid, Float:xmin, Float:ymin, Float:xmax, Float:ymax) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); if(x >= xmin && y >= ymin && xmax <= xmax && y <= ymax) return true; return false; }