15.04.2011, 20:23
hi all
i have a problem !
i have some saving fuction ''dini" and i foud a bug in my GM
the bug is when a player leav the server by a (CRASH) ! the game mod set the team of the crashed player to the next conectin player!
this is my codes
i have a problem !
i have some saving fuction ''dini" and i foud a bug in my GM
the bug is when a player leav the server by a (CRASH) ! the game mod set the team of the crashed player to the next conectin player!
this is my codes
Код:
public OnPlayerConnect(playerid) { if(!dini_Exists(playerfile)) { dini_Create(playerfile); dini_IntSet(playerfile, "Team", 1); } else if(dini_Exists(playerfile)) { SetPlayerTeam(playerid, dini_Int(playerfile, "Team")); } return 1; }
Код:
public OnPlayerDisconnect(playerid, reason) { new name[MAX_PLAYER_NAME]; new playerfile[100]; new string[56]; GetPlayerName(playerid, name, sizeof(name)); switch(reason) { case 0: format(string,sizeof string,"%s left the server.(Crashed)",name); case 1: { format(string, sizeof(string), "%s left the server.(Leaving)", name); format(playerfile, sizeof(playerfile), "Premium/Users/%s.ini",name); dini_IntSet(playerfile, "Team", GetPlayerTeam(playerid)); } case 2: { format(string, sizeof(string), "%s left the server.(Kick/Ban)", name); format(playerfile, sizeof(playerfile), "Premium/Users/%s.ini",name); dini_IntSet(playerfile, "Team", GetPlayerTeam(playerid)); } } SendClientMessageToAll(0xAAAAAAAA, string); return 1; }