22.05.2010, 01:13
I had a go at coding a health test but im having a little trouble with it. It compiles no problem but it somehow blocks other commands in my game mode from working. Can someone please take a look at it and see why it blocks commands. Thanks to anyone who can help.
Heres the code.
Heres the code.
Quote:
if(strcmp(cmd, "/test", true)==0) { if(IsPlayerLAdmin(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /test [ID]"); return 1; } new pid = strval(tmp); if (IsPlayerConnected(pid)) { storeint[pid] = GetPlayerInterior(playerid); GetPlayerPos(pid, Floattorex[playerid], Floattorey[playerid], Floattorez[playerid]); SetPlayerPos(pid,-1128.5248,835.2584,3.077; SetPlayerHealth(pid,10); OldHealth = GetPlayerHealth(pid,Health); TogglePlayerControllable(pid,0); BeingTested[pid] = 1; SetTimer("HealthTest", 6000, 0); return 1; } } return 1; } |
Quote:
forward HealthTest(); public HealthTest() { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(BeingTested[i] == 1) { BeingTested[i] = 0; GetPlayerHealth(i,Health); if(Health > OldHealth) { new string [256]; new pName[MAX_PLAYER_NAME]; GetPlayerName(i, pName, sizeof(pName)); format(string, sizeof(string), "%s was kicked due to health cheats", pName); SendClientMessageToAll(0x33CCFFAA, string); Kick(i); SaveToFile("KickLog",string); } else if(Health == OldHealth) { new string [256]; new pName[MAX_PLAYER_NAME]; GetPlayerName(i, pName, sizeof(pName)); format(string, sizeof(string), "%s is not cheating.", pName); SendClientMessageToAll(0x33CCFFAA, string); SetPlayerHealth(i,100); SetPlayerInterior(i, storeint[i]); DOO_SetPlayerPos(i, storex[i],storey[i],storez[i]); TogglePlayerControllable(i,1); } } } } return 1; |