SA-MP Forums Archive
Small question(s) - 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: Small question(s) (/showthread.php?tid=280533)



Small question(s) - FrostDoggy - 01.09.2011

1. I am not sure , I didn't used from long time this.

For eg a command.

Код:
	if(strcmp(cmdtext, "/h2", true) == 0)
	{
		MoveObject(GateH,-1770.56152344,984.83020020,25.154365545, 3);
		return 1;
	}
How I make it to be just for RCON admin.

2.Is there on the forum , I didn't saw a normal , like single player clock?

Thanks in advance.


Re: Small question(s) - PhoenixB - 01.09.2011

Change your code to this

pawn Код:
if(strcmp(cmdtext, "/h2", true) == 0)
{
    if(IsPlayerAdmin(playerid))
    {
        MoveObject(GateH,-1770.56152344,984.83020020,25.154365545, 3);
        return 1;
    }
    else
    {
        SendClientMessage(playerid, 0xDEEE20FF, "You must be an admin to use this command");
    }
    return 1;
}
That will make the command work just for an RCON administrator that is Logged in


Re: Small question(s) - RyDeR` - 01.09.2011

1) Add a condition:
pawn Код:
if(IsPlayerAdmin(playerid))
{

}
2) Yes, search.

EDIT: Seems like the poster above me was earlier.


Re: Small question(s) - [MWR]Blood - 01.09.2011

About the first question:
pawn Код:
if(strcmp(cmdtext, "/h2", true) == 0)
    {
                if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You need to be logged in RCON to perform this command!");
        MoveObject(GateH,-1770.56152344,984.83020020,25.154365545, 3);
        return 1;
    }
About the clock, just search.
I'm sure you are going to find some filterscript that you like.


Re: Small question(s) - Kwarde - 01.09.2011

EDIT:
Omg 3 guys beat me xD

Use the 'IsPlayerAdmin(playerid)':
pawn Код:
if(strcmp(cmdtext, "/h2", true) == 0)
{
    if(!IsPlayerAdmin(playerid)) return 0; //Return a 'SERVER: Unknown command' (or user defined if you did that) if the player's not an admin
    MoveObject(GateH,-1770.56152344,984.83020020,25.154365545, 3);
    return 1;
}
Single player clock can be turned on/off with TogglePlayerClock(playerid, toggle);


Re: Small question(s) - [MWR]Blood - 01.09.2011

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
EDIT:
Omg 3 guys beat me xD

Use the 'IsPlayerAdmin(playerid)':
pawn Код:
if(strcmp(cmdtext, "/h2", true) == 0)
{
    if(!IsPlayerAdmin(playerid)) return 0; //Return a 'SERVER: Unknown command' (or user defined if you did that) if the player's not an admin
    MoveObject(GateH,-1770.56152344,984.83020020,25.154365545, 3);
    return 1;
}
Single player clock can be turned on/off with TogglePlayerClock(playerid, toggle);
Lol, I completely forgot about that function.