SA-MP Forums Archive
Commands for rcon admin - 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: Commands for rcon admin (/showthread.php?tid=345620)



Commands for rcon admin - davve95 - 25.05.2012

Hi!


How can I make so just rcon admins can use some commands?..

1 one Msn told me 1 time but I forgot :/ thanks.


AW: Commands for rcon admin - EthanR - 25.05.2012

check
Код:
if(!IsPlayerAdmin(playerid)) return 0;



Re: Commands for rcon admin - davve95 - 25.05.2012

Thanks alot! and for fast reply!!.. But I mean something to put the cmds under some script line and the accounts must
have rcon acces...
Sorry for bad explain but hard to explain.. Btw it maybe work with that u said..


Re: Commands for rcon admin - TheDominator - 25.05.2012

I think that would work, it checks to see if the player is an administrator, RCON in this case.


AW: Commands for rcon admin - EthanR - 25.05.2012

if(IsPlayerAdmin(playerid)) returns 1 if the player is logged into the RCON.

so just ask

Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFF, "** You are not logged into the RCON. You can't use this command.");



Re: Commands for rcon admin - davve95 - 25.05.2012

Quote:
Originally Posted by TheDominator
Посмотреть сообщение
I think that would work, it checks to see if the player is an administrator, RCON in this case.
Yes I would edit but u came to fast but np!! .
But I should say like this:

if(!IsPlayerAdmin(playerid))
{
GivePlayerWeapon

Don't complain about if there are errors in my example because just example and didn't check for errors etc..


Re: Commands for rcon admin - Hoss - 25.05.2012

pawn Код:
CMD:command(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not logged into Rcon"); // Sends client message that he is not logged into rcon
GivePlayerWeapon(playerid,38,500); // Gives player weapon if he is logged into RCON
return 1;
}



Re: Commands for rcon admin - TheDominator - 25.05.2012

Yes you must always use
pawn Код:
if(!IsPlayerAdmin(playerid))
before anything else or it would load the code first and then check if your RCON.


Re: Commands for rcon admin - davve95 - 25.05.2012

Okay thanks alot!.


Re: Commands for rcon admin - Saad_ - 25.05.2012

Quote:
Originally Posted by TheDominator
Посмотреть сообщение
Yes you must always use
pawn Код:
if(!IsPlayerAdmin(playerid))
before anything else or it would load the code first and then check if your RCON.
The ! returns No


Re: Commands for rcon admin - davve95 - 26.05.2012

Where should I put commands? Because I'm making a fs..
I mean how can I make so I'm not got weapon directly when I login.. Just get them with
a command.. Hmm I think how..


Does it works with this:

pawn Код:
public OnFilterScriptInit()
{

    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}
    public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/weapon", cmdtext, true, 10) == 0)
    {
        CMD:command(playerid,params[])  if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not logged into Rcon"); // Sends client message that he is not logged into rcon
        GivePlayerWeapon(playerid,38,500); // Gives player weapon if he is logged into RCON
    }
    return 0;
}
public OnFilterScriptExit()
{
    return 0;
}

#else
#endif
But I don't get any weapon... Idk if it will work like that my first FS xD..


Re: Commands for rcon admin - TheDominator - 26.05.2012

It seems as if your using strcmp and Zcmd to use for commands which isn't possible, what you should try is:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/weapon", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerAdmin(playerid))
        return SendClientMessage(playerid,-1,"You are not logged into Rcon"); //    Sends client message that he     is not logged into rcon
        GivePlayerWeapon(playerid,38,500); // Gives player weapon if he is logged into RCON
        return 1;
    }
    return 0;
}
I am sorry if it doesn't work but at the moment I am unable to test it due to the fact that my GTA_SA has suddenly decided it wants to crash.


Re: Commands for rcon admin - davve95 - 26.05.2012

Quote:
Originally Posted by TheDominator
Посмотреть сообщение
It seems as if your using strcmp and Zcmd to use for commands which isn't possible, what you should try is:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/weapon", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerAdmin(playerid))
        return SendClientMessage(playerid,-1,"You are not logged into Rcon"); //    Sends client message that he     is not logged into rcon
        GivePlayerWeapon(playerid,38,500); // Gives player weapon if he is logged into RCON
        return 1;
    }
    return 0;
}
I am sorry if it doesn't work but at the moment I am unable to test it due to the fact that my GTA_SA has suddenly decided it wants to crash.
Okay thanks alot!! . I hope it will help.

Edit didn't workt .