How can I make a command require the player to be logged in via RCON in order to execute it? I wish to do this for security reasons.
Asked
Active
Viewed 594 times
1
-
1This seems to be about an API implemented in PAWN. OP, can you edit your title to specify the API? (I'm guessing it's one of these: San Andreas Multiplayer mod, Half-Life mod, AMX Mod X and Source Engine based SourceMod) – user247702 Aug 07 '13 at 12:34
-
@Stijn is right, OP. My code below will only work if you are using the San Andreas Multiplayer mod API – James Monger Aug 07 '13 at 12:51
-
Sorry for inconveniences, I am using samp mod – Clove Aug 07 '13 at 13:14
-
James monger your code was correctly and fixed my script – Clove Aug 07 '13 at 13:15
-
@Stijn in future I will be using the sa-mp for any of sa-mp questions I post – Clove Aug 07 '13 at 14:10
-
1@Clove Please do, I've just made the tag as it didn't exist yet :) – user247702 Aug 07 '13 at 14:39
1 Answers
3
The method IsPlayerAdmin(playerid) will return 1 if the player is logged in via RCON and 0 if the player isn't. To use this for a command, go into the command body and add an if-statement around the part of the command you wish to protect. For example:
if(IsPlayerAdmin(playerid))
{
//do stuff here
}
else
{
//do nothing, explain security settings to user
}
James Monger
- 10,181
- 7
- 62
- 98