[HELP] Gates
#1

How to put it so admins only can use the gate?

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/pgate", true)==0)
	{
		SendClientMessage(playerid, COLOR_BBLUE, "Gate opening ... close automaticaly!");
		MoveObject(pgate, 829.798,-2067.799,8.735, 1.5);
		SetTimer("pgatet", 5000, 0);
	    return 1;
	}

    if(strcmp(cmdtext, "/g1", true)==0)
	{
		SendClientMessage(playerid, COLOR_BBLUE, "Garage [1] opening ... close automaticaly!");
		MoveObject(g1gate, 841.935,-2077.986,7.885, 1.5);
		SetTimer("g1gatet", 10000, 0);
	    return 1;
	}
	
	if(strcmp(cmdtext, "/g2", true)==0)
	{
		SendClientMessage(playerid, COLOR_BBLUE, "Garage [2] opening ... close automaticaly!");
		MoveObject(g2gate, 854.147,-2078.010,7.844, 1.5);
		SetTimer("g2gatet", 10000, 0);
	    return 1;
	}
Reply
#2

Next time use and put your code in.

Here is it:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/pgate", true)==0)
    {
        if(IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFF0000FF,"You are not an admin");
        SendClientMessage(playerid, COLOR_BBLUE, "Gate opening ... close automaticaly!");
        MoveObject(pgate, 829.798,-2067.799,8.735, 1.5);
        SetTimer("pgatet", 5000, 0);
        return 1;
    }

    if(strcmp(cmdtext, "/g1", true)==0)
    {
        if(IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFF0000FF,"You are not an admin");
        SendClientMessage(playerid, COLOR_BBLUE, "Garage [1] opening ... close automaticaly!");
        MoveObject(g1gate, 841.935,-2077.986,7.885, 1.5);
        SetTimer("g1gatet", 10000, 0);
        return 1;
    }
   
    if(strcmp(cmdtext, "/g2", true)==0)
    {
        if(IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFF0000FF,"You are not an admin");
        SendClientMessage(playerid, COLOR_BBLUE, "Garage [2] opening ... close automaticaly!");
        MoveObject(g2gate, 854.147,-2078.010,7.844, 1.5);
        SetTimer("g2gatet", 10000, 0);
        return 1;
    }
You can use:

pawn Код:
IsPlayerAdmin(playerid);
Reply
#3

Nope....

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/pgate", true)==0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessege(playerid,0xFF0000FF,"You are not an admin);
        SendClientMessage(playerid, COLOR_BBLUE, "
Gate opening ... close automaticaly!");
        MoveObject(pgate, 829.798,-2067.799,8.735, 1.5);
        SetTimer("
pgatet", 5000, 0);
        return 1;
    }

    if(strcmp(cmdtext, "
/g1", true)==0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessege(playerid,0xFF0000FF,"
You are not an admin);
        SendClientMessage(playerid, COLOR_BBLUE, "Garage [1] opening ... close automaticaly!");
        MoveObject(g1gate, 841.935,-2077.986,7.885, 1.5);
        SetTimer("g1gatet", 10000, 0);
        return 1;
    }
   
    if(strcmp(cmdtext, "/g2", true)==0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessege(playerid,0xFF0000FF,"You are not an admin);
        SendClientMessage(playerid, COLOR_BBLUE, "
Garage [2] opening ... close automaticaly!");
        MoveObject(g2gate, 854.147,-2078.010,7.844, 1.5);
        SetTimer("
g2gatet", 10000, 0);
        return 1;
    }
    //More commands
    return 0;
}
Reply
#4

Tried but keep getting:

Код:
Real Server\filterscripts\ah_ls_v1.pwn(162) : error 001: expected token: ";", but found "return"
Real Server\filterscripts\ah_ls_v1.pwn(162) : error 017: undefined symbol "SendClientMessege"
Real Server\filterscripts\ah_ls_v1.pwn(162) : error 017: undefined symbol "You"
Real Server\filterscripts\ah_ls_v1.pwn(162) : fatal error 107: too many error messages on one line
And Willsuckformoney it says:
Код:
Real Server\filterscripts\ah_ls_v1.pwn(162) : error 017: undefined symbol "SendClientMessege"
Real Server\filterscripts\ah_ls_v1.pwn(162) : error 017: undefined symbol "You"
Real Server\filterscripts\ah_ls_v1.pwn(162) : error 017: undefined symbol "are"
Real Server\filterscripts\ah_ls_v1.pwn(162) : fatal error 107: too many error messages on one line
It's a filterscript maybe that's the problem ?
Reply
#5

Try my code again i fixed it and i told u use to put your code

Here is it:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/pgate", true)==0)
    {
        if(IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFF0000FF,"You are not an admin");
        SendClientMessage(playerid, COLOR_BBLUE, "Gate opening ... close automaticaly!");
        MoveObject(pgate, 829.798,-2067.799,8.735, 1.5);
        SetTimer("pgatet", 5000, 0);
        return 1;
    }

    if(strcmp(cmdtext, "/g1", true)==0)
    {
        if(IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFF0000FF,"You are not an admin");
        SendClientMessage(playerid, COLOR_BBLUE, "Garage [1] opening ... close automaticaly!");
        MoveObject(g1gate, 841.935,-2077.986,7.885, 1.5);
        SetTimer("g1gatet", 10000, 0);
        return 1;
    }
   
    if(strcmp(cmdtext, "/g2", true)==0)
    {
        if(IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFF0000FF,"You are not an admin");
        SendClientMessage(playerid, COLOR_BBLUE, "Garage [2] opening ... close automaticaly!");
        MoveObject(g2gate, 854.147,-2078.010,7.844, 1.5);
        SetTimer("g2gatet", 10000, 0);
        return 1;
    }
You can use:

pawn Код:
IsPlayerAdmin(playerid);
Reply
#6

I should look over others codes better...

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/pgate", true)==0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessege(playerid,0xFF0000FF,"You are not an admin");
        SendClientMessage(playerid, COLOR_BBLUE, "Gate opening ... close automaticaly!");
        MoveObject(pgate, 829.798,-2067.799,8.735, 1.5);
        SetTimer("pgatet", 5000, 0);
        return 1;
    }

    if(strcmp(cmdtext, "/g1", true)==0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessege(playerid,0xFF0000FF,"You are not an admin");
        SendClientMessage(playerid, COLOR_BBLUE, "Garage [1] opening ... close automaticaly!");
        MoveObject(g1gate, 841.935,-2077.986,7.885, 1.5);
        SetTimer("g1gatet", 10000, 0);
        return 1;
    }
   
    if(strcmp(cmdtext, "/g2", true)==0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessege(playerid,0xFF0000FF,"You are not an admin");
        SendClientMessage(playerid, COLOR_BBLUE, "Garage [2] opening ... close automaticaly!");
        MoveObject(g2gate, 854.147,-2078.010,7.844, 1.5);
        SetTimer("g2gatet", 10000, 0);
        return 1;
    }
    //More commands
    return 0;
}
EDIT: Tee, your code that you posted, if they are RCON Admins, they cant use the command.

Remember if they are not RCON Admin use this...

pawn Код:
if(!IsPlayerAdmin(playerid)) //NOTICE the '!' That means if they are NOT admin.
Reply
#7

Well that works !
but is there a way to put it in so all admins can and not just rcon ?
Reply
#8

Well, what admin system you using?
Reply
#9

Quote:
Originally Posted by willsuckformoney
Посмотреть сообщение
I should look over others codes better...

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/pgate", true)==0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessege(playerid,0xFF0000FF,"You are not an admin");
        SendClientMessage(playerid, COLOR_BBLUE, "Gate opening ... close automaticaly!");
        MoveObject(pgate, 829.798,-2067.799,8.735, 1.5);
        SetTimer("pgatet", 5000, 0);
        return 1;
    }

    if(strcmp(cmdtext, "/g1", true)==0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessege(playerid,0xFF0000FF,"You are not an admin");
        SendClientMessage(playerid, COLOR_BBLUE, "Garage [1] opening ... close automaticaly!");
        MoveObject(g1gate, 841.935,-2077.986,7.885, 1.5);
        SetTimer("g1gatet", 10000, 0);
        return 1;
    }
   
    if(strcmp(cmdtext, "/g2", true)==0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessege(playerid,0xFF0000FF,"You are not an admin");
        SendClientMessage(playerid, COLOR_BBLUE, "Garage [2] opening ... close automaticaly!");
        MoveObject(g2gate, 854.147,-2078.010,7.844, 1.5);
        SetTimer("g2gatet", 10000, 0);
        return 1;
    }
    //More commands
    return 0;
}
EDIT: Tee, your code that you posted, if they are RCON Admins, they cant use the command.

Remember if they are not RCON Admin use this...

pawn Код:
if(!IsPlayerAdmin(playerid)) //NOTICE the '!' That means if they are NOT admin.
Thanks i just learned something.
Reply
#10

[pAdmin] i guess "[GM] GTARP"
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)