Posts: 90
Threads: 41
Joined: Feb 2018
Reputation:
0
So, as title says, i want a command for /god but not that normal which when you type
/god it makes you really god mode,
I want it when you type /god the player doesn't have access to a weapons if he tries, it doesn't give the player weapons and says that in god mode can't have weapons
and a command maybe like a: /godoff to make the god mode off and to make you use weapons again.
I know maybe its easy but im new :P
Posts: 403
Threads: 88
Joined: Sep 2014
Reputation:
0
Use ResetPlayerWeapons, and make a check to see if a player is in god mode
"new IsPlayerGod[MAX_PLAYERS];"
Posts: 90
Threads: 41
Joined: Feb 2018
Reputation:
0
Ok that will do it! but how to do if player gets an weapon it automatic removes the weapon.
And says that he can't have weapons if it is god mode
Sorry for my bad english
Posts: 12
Threads: 0
Joined: Feb 2018
Simple,
Check if the player is on god mode, and then reset his weapons.
Posts: 90
Threads: 41
Joined: Feb 2018
Reputation:
0
Code for this? (Sorry, i hard understand)
Posts: 12
Threads: 0
Joined: Feb 2018
I would suggest you to learn to basics through SA-MP Wiki
https://sampwiki.blast.hk/wiki/Scripting_Basics
You will not learn anything if you get free codes, Try to script it and if you get any issues post it here and we will help you.
Posts: 90
Threads: 41
Joined: Feb 2018
Reputation:
0
Ok i made it like this:
CMD:god(playerid, params[])
{
if(GodMode[playerid] == 0)
{
GodMode[playerid] = 1;
SendClientMessage(playerid, -1, "You're now on duty");
SetPlayerArmedWeapon(playerid, 0);
ResetPlayerWeapons(playerid);
}
else
{
if(GodMode[playerid] == 1)
{
GodMode[playerid] = 0;
SendClientMessage(playerid,-1,"You're now off duty");
}
return 1;
}
And i think that should work: I added ResetPlayerWeapons(playerid);
And this should reset weapons if he have when it launch the command.
But i have other problem, how do i make when player gets weapon it removes it again? When its god mode.
Posts: 124
Threads: 3
Joined: Oct 2011
Reputation:
0
To remove weapons again, you should add a check in a constantly looping second timer or OnPlayerUpdate or whatever to reset the weapons IF the player is in godmode.
To avoid using a timer (if you don't have one already), you could just null the damage sent by the player in godmode so that nobody is hurt by his weapons so that you don't even need to remove them in the first place. I believe you can do that by checking if the player has godmode activated in OnPlayerWeaponShot and returning 0.