SA-MP Forums Archive
problem with god admin does not turn off - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: problem with god admin does not turn off (/showthread.php?tid=653663)



problem with god admin does not turn off - nbx2000 - 09.05.2018

hello guys I have a problem with god admin system when I use cmd god and active and walk perfect when I disconnect the god is still on and another non-administrator player enters and has god




CMD:god(playerid,params[]) {
#pragma unused params
if(PlayerInfo[playerid][Level] >= 2) {
if(PlayerInfo[playerid][God] == 0) {
PlayerInfo[playerid][God] = 1;
SetPlayerHealth(playerid,100000);
GivePlayerWeaponEx(playerid,16,50000); GivePlayerWeaponEx(playerid,26,50000);
SendClientMessage(playerid,green,"GODMODE ON");
return CMDMessageToAdmins(playerid,"GOD");
} else {
PlayerInfo[playerid][God] = 0;
SendClientMessage(playerid,red,"GODMODE OFF");
SetPlayerHealth(playerid, 100);
} return GivePlayerWeaponEx(playerid,35,0);
} else return SendClientMessage(playerid,red,"ERROR: You need to be Admins to use this command");
}


Re: problem with god admin does not turn off - OneMillion - 09.05.2018

Make your life easier by organizing your code

Код:
CMD:god(playerid) 
{ 
	if(PlayerInfo[playerid][Level]> = 2) 
	{ 
		if(PlayerInfo[playerid][God] == 0) 
		{ 
			PlayerInfo[playerid][God] = 1; 
			SetPlayerHealth(playerid, 100000.0); 
			GivePlayerWeaponEx(playerid, 16, 50000); 
			GivePlayerWeaponEx(playerid, 26, 50000); 
			GivePlayerWeaponEx(playerid, 35, 50000); 
			SendClientMessage (playerid, green, "GODMODE ON"); 
			CMDMessageToAdmins (playerid, "GOD (on)"); 
		} 
		else
		{ 
			PlayerInfo[playerid][God] = 0; 
			SendClientMessage(playerid, red, "GODMODE OFF"); 
			SetPlayerHealth(playerid, 100.0); 
			CMDMessageToAdmins (playerid, "GOD (off)"); 
		} 
	}
	else return SendClientMessage (playerid, red, "ERROR: You need to be Admins to use this command"); 
	return 1;
}
Add this to OnPlayerDisconnect:
Код:
PlayerInfo[playerid][God] = 0; //set god mode to 0 or the disconnecting player
SetPlayerHealth(playerid, 100.0);



Re: problem with god admin does not turn off - nbx2000 - 10.05.2018

Quote:
Originally Posted by OneMillion
Посмотреть сообщение
Make your life easier by organizing your code

Код:
CMD:god(playerid) 
{ 
	if(PlayerInfo[playerid][Level]> = 2) 
	{ 
		if(PlayerInfo[playerid][God] == 0) 
		{ 
			PlayerInfo[playerid][God] = 1; 
			SetPlayerHealth(playerid, 100000.0); 
			GivePlayerWeaponEx(playerid, 16, 50000); 
			GivePlayerWeaponEx(playerid, 26, 50000); 
			GivePlayerWeaponEx(playerid, 35, 50000); 
			SendClientMessage (playerid, green, "GODMODE ON"); 
			CMDMessageToAdmins (playerid, "GOD (on)"); 
		} 
		else
		{ 
			PlayerInfo[playerid][God] = 0; 
			SendClientMessage(playerid, red, "GODMODE OFF"); 
			SetPlayerHealth(playerid, 100.0); 
			CMDMessageToAdmins (playerid, "GOD (off)"); 
		} 
	}
	else return SendClientMessage (playerid, red, "ERROR: You need to be Admins to use this command"); 
	return 1;
}
Add this to OnPlayerDisconnect:
Код:
PlayerInfo[playerid][God] = 0; //set god mode to 0 or the disconnecting player
SetPlayerHealth(playerid, 100.0);
thanks bro simple y add PlayerInfo[playerid][God] = 0 y setplayerhelath 100 . 100 done fix problema thanks !!! bro