How to make a specifc Teleport for Admins only?
#1

Sorry, I'm a bit new at scripting, but enjoying it alot. Anyways I'm just wondering what I need to add to this to make it for Admins only, thanks. (Also if you could tell me, like how to make something for LSPD only or The Army, ex: Opening a specific gate"


Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/cia", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, 100.7311,1920.8513,18.2811);
SendClientMessage(playerid, 0xFFFF40FF, "You have been Teleported");
return 1;
}

Thanks for your help guys, this community is making me a better scripter already.
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp(cmdtext, "/cia", true) == 0)
    {

        if(IsPlayerAdmin(playerid))
        {

            SetPlayerPos(playerid, 100.7311,1920.8513,18.2811);
            SendClientMessage(playerid, 0xFFFF40FF, "You have been Teleported");
            SendClientMessage(playerid, -1, "You had been teleported");



         return 1;
        }
        else
        {
        SendClientMessage(playerid, -1, "You are not allowed to use this command.");
        return 1;
        }
    }
    return 0;
}
Reply
#3

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(IsPlayerAdmin(playerid)) {
        if (strcmp("/cia", cmdtext, true, 10) == 0) {
            SetPlayerPos(playerid, 100.7311,1920.8513,18.2811);
            SendClientMessage(playerid, 0xFFFF40FF, "You have been Teleported");
        }
    }
    return 1;
}


// making it only teams you need to define some shortcuts and variables
//example below

new gTeam[MAX_PLAYERS];

#define TEAM_ARMY 0
#define TEAM_LSPD 1

if(gTeam[playerid] == TEAM_ARMY)
{
    if (strcmp("/army", cmdtext, true, 10) == 0) {
//army only can do here
    }
Reply
#4

Wow thats really simple. Thank you very much.
Reply
#5

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/cia", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "This is an admin only command!");
        SetPlayerPos(playerid, 100.7311,1920.8513,18.2811);
        SendClientMessage(playerid, 0xFFFF40FF, "You have been Teleported");
    }
    return 1;
}
Reply
#6

Btw, stupid question. How do I make a pawn code instead of quotes? I don't see an option for it.
Reply
#7

Use
pawn Код:
// Use [ pawn] [/ pawn]
Reply
#8

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
Btw, stupid question. How do I make a pawn code instead of quotes? I don't see an option for it.
..... [code] /code]
Reply
#9

Thanks.
Reply
#10

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
Thanks.
[php] /php]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)