SA-MP Forums Archive
Help with GodMode commands :D - 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: Help with GodMode commands :D (/showthread.php?tid=629048)



Help with GodMode commands :D - TheseMan - 19.02.2017

Hi everyone, I've tried to eliminate the weapons when the player uses GodMode command, I mean .. I want the player did not use a weapon while being GodMode, I've tried but failed .. maybe you guys can help, please

Thank you for helping me


Re: Help with GodMode commands :D - TheseMan - 19.02.2017

I mean when a player uses GodMode command, the player can not use weapons command


Re: Help with GodMode commands :D - Flamehaze7 - 19.02.2017

Top of the gamemode:
Код:
new IsGodmode[MAX_PLAYERS];
I'll just make a quick example of how you have to do with your "guns command"
Код:
CMD:guns(playerid,params[])
{
if (IsGodmode[playerid] == 1) { //checks that the guy that is doing the command is godmode or not
SendClientMessage(playerid,COLOR_RED,"You can't use that command while in Godmode!"); //sends a message on chat
} else { //if he isn't godmode do the following
GivePlayerWeapon(playerid,31,300); //It gives the weapon
}
return 1;
}



Re: Help with GodMode commands :D - YouHack - 19.02.2017

Just a little fix for the above command,
because it may cause some kind of bug depending on your code

On top of script:
Код:
new godmodestatus[MAX_PLAYERS];
In OnPlayerConnect write this:
Код:
godmodestatus = 0;
Under your godmode command write this:
PHP код:
// if enabled -- depends on your command :/ idk what it will be
godmodestatus 1;
// if disabled -- depends on your command :/ idk what it will be too
godmodestatus 0
and finally under your weapons cmd:
PHP код:
CMD:weapons(playerid,params[])
{
   if (
godmodestatus[playerid] == 1) return SendClientMessage(playerid, -1"You can't get weapons if godmode is on!");
   
// code

Hope it helps.


Re: Help with GodMode commands :D - TheseMan - 20.02.2017

Thank you all for helping me, +Rep


Re: Help with GodMode commands :D - K1ddu - 29.04.2018

Nice gj