SA-MP Forums Archive
[HELP] Gates - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Gates (/showthread.php?tid=178956)



[HELP] Gates - NotoriousMOB - 24.09.2010

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;
	}



Re: [HELP] Gates - Tee - 24.09.2010

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);



Re: [HELP] Gates - willsuckformoney - 24.09.2010

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;
}



Re: [HELP] Gates - NotoriousMOB - 24.09.2010

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 ?


Re: [HELP] Gates - Tee - 24.09.2010

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);



Re: [HELP] Gates - willsuckformoney - 24.09.2010

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.



Re: [HELP] Gates - NotoriousMOB - 24.09.2010

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


Re: [HELP] Gates - willsuckformoney - 24.09.2010

Well, what admin system you using?


Re: [HELP] Gates - Tee - 24.09.2010

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.


Re: [HELP] Gates - NotoriousMOB - 24.09.2010

[pAdmin] i guess "[GM] GTARP"