Commands doesn't work!
#1

No admin rights, damn!

This is my code for example!

Код:
Password=(I won't say)
Cash=0
Admin=1
Score=0
It's for the User EazyE(me) and for samtey, too!

When I type /kick, /god, /energy he says: You are not an administrator!

The teleport funtion /goto doesn't work either: SERVER:Unknown Command![/QUOTE]



The commands? Here:

pawn Код:
CMD:energy(playerid, params[])
{
    if(IsPlayerAdmin(playerid)) {
        new ID;
        if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0x0022FFFF, "USAGE: /energy");
        SetPlayerHealth(ID, 100);
    }
    else
    {
        SendClientMessage(playerid, 0x0022FFFF, "You are not an administrator, so you can't use this command!");
    }
    return 1;
}




CMD:kick(playerid, params[])
{
    if(IsPlayerAdmin(playerid)) {
        new PID;
        if(sscanf(params, "u", PID)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]");

        if(!IsPlayerConnected(PID))
            return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");

        Kick(PID);
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You are not an administrator, so you can't use this command!");
    }
    return 1;
}



CMD:teleport(playerid, params[])
{
    if(IsPlayerAdmin(playerid)) {
        new ID;
        if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /goto [playerid]");
        else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
        else
        {
            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid, x, y, z);
            SetPlayerPos(ID, x+1, y+1, z);
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You are not an administrator, so you can't use this command!");
    }
    return 1;
}


CMD:god(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        if(HasGod[playerid] == 0)
        {
            HasGod[playerid] = 1;
            SendClientMessage(playerid, -1, "God mode turned on!");
        }
        else if(HasGod[playerid] == 1)
        {
            HasGod[playerid] = 0;
            SendClientMessage(playerid, -1, "God mode turned off!");
        }
    }
    else return SendClientMessage(playerid, -1, "You are not an admin");
    return 1;
}
Reply
#2

you made the commands only for rcon admins
Reply
#3

Replace

pawn Код:
if(IsPlayerAdmin(playerid))
with

pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 1)
EDIT:

Or go in game and type /rcon login [RCON PASS] and then all the commands will work.
Reply
#4

So what should I do that it is for rcon_admins and normal admins>?
Reply
#5

Try these, not tested.
pawn Код:
CMD:energy(playerid, params[]) {
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x0022FFFF, "You are not an administrator, so you can't use this command!");
    SetPlayerHealth(playerid, 100);
    return 1;
}
pawn Код:
CMD:kick(playerid, params[]) {
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an administrator, so you can't use this command!");
    new PID, reason[65], r_string[128];
    if(sscanf(params, "uz", PID, reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]");
    if(PID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
    if(isnull(reason)) format(r_string, sizeof(r_string), "%s has kicked %s, reason: No reason", GetPlayerNameEx(playerid), GetPlayerNameEx(PID));
    else format(r_string, sizeof(r_string), "%s has kicked %s, reason: %s", GetPlayerNameEx(playerid), GetPlayerNameEx(PID), reason);
    SendClientMessageToAll(-1, r_string);
    Kick(PID);
    return 1;
}

stock GetPlayerNameEx(playerid) {
    new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    return PlayerName;
}
pawn Код:
CMD:teleport(playerid, params[]) {
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an administrator, so you can't use this command!");
    new ID;
    if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /goto [playerid]");
    if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    SetPlayerPos(ID, x+1, y+1, z);
    return 1;
}
pawn Код:
CMD:god(playerid, params[]) {
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not an admin");
    if(!HasGod[playerid]) {
        HasGod[playerid] = 1;
        SendClientMessage(playerid, -1, "God mode turned on!");
    } else if(HasGod[playerid]) {
        HasGod[playerid] = 0;
        SendClientMessage(playerid, -1, "God mode turned off!");
    }
    return 1;
}
EDIT: Do not update your SA-MP server to R5, because parameter "u" would stop working, ****** will fix this soon.
Reply
#6

Here you go: http://pastebin.com/kgvZGm3e

I've never thought I'd have to go back to SII, but this is just for you
Reply
#7

That's scaring, you all know every mode around SA-MP...
Also, mine should work perfect, I think.
Reply
#8

Thanks, but only my /goto didn't work!^^

Still got a problem with my /energy command

I type /energy: USAGE:/energy

My health has to be set to 100 now! But this isn't working! My command is in my first post!
Reply
#9

Mine should work, you don't need to use sscanf in energy command!
Reply
#10

Fool, yours didn't work, you forgot an new variable for ID, too! -.-

pawn Код:
CMD:energy(playerid, params[]) {
    new ID;
    if(PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid, 0x0022FFFF, "You are not an administrator, so you can't use this command!");
    SetPlayerHealth(ID, 100);
    return 1;
}
Still he says: You are not an admin, blah blah blah!

I logged in with rcon, too, but it didn't work!
Reply
#11

PHP код:
CMD:energy(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0x0022FFFF"You are not an administrator, so you can't use this command!");
    new 
ID;
    if(
sscanf(params"u"ID)) return SendClientMessage(playerid0x0022FFFF"USAGE: /energy");
    
SetPlayerHealth(ID100);
    return 
1;
}
CMD:kick(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOLOR_GREY"You are not an administrator, so you can't use this command!");
    new 
PID;
    if(
sscanf(params"u"PID)) return SendClientMessage(playeridCOLOR_GREY"USAGE: /kick [playerid] [reason]");
    if(!
IsPlayerConnected(PID)) return SendClientMessage(playeridCOLOR_GREY"Player is not connected!");
    
Kick(PID);
    return 
1;
}
CMD:teleport(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOLOR_GREY"You are not an administrator, so you can't use this command!");
    new 
ID;
    if(
sscanf(params"u"ID)) SendClientMessage(playeridCOLOR_GREY"USAGE: /goto [playerid]");
    if(!
IsPlayerConnected(ID)) SendClientMessage(playeridCOLOR_GREY"Player is not connected!");
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    
SetPlayerPos(IDx+1y+1z);
    return 
1;
}
CMD:god(playeridparams[])
{
    
#pragma unused params
    
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"You are not an admin");
    if(!
HasGod[playerid])
    {
        
HasGod[playerid] = 1;
        
SendClientMessage(playerid, -1"God mode turned on!");
    }
    else
    {
        
HasGod[playerid] = 0;
        
SendClientMessage(playerid, -1"God mode turned off!");
    }
    return 
1;

Reply
#12

THE OTHERS ARE RIGHT, ONLY /energy doesn't work!



I tried it with rcon_login! Still didn't work!

Should I give it a try with

if(PlayerInfo[playerid][pAdmin] >= 1)

instead of

if(!IsPlayerAdmin(playerid))
Reply
#13

Quote:
Originally Posted by samtey
Посмотреть сообщение
THE OTHERS ARE RIGHT, ONLY /energy doesn't work!



I tried it with rcon_login! Still didn't work!

Should I give it a try with

if(PlayerInfo[playerid][pAdmin] >= 1)

instead of

if(!IsPlayerAdmin(playerid))
PHP код:
CMD:energy(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] || IsPlayerAdmin(playerid))
    {
        
SetPlayerHealth(playerid100);
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GREY"You are not authorized to use that command!");
    }
    return 
1;

Reply
#14

Do not call me FOOL, I had a mistake, so what the fuck is your problem, uh?
Now, figure this by yourself... chea, you don't even know what the command should preform.

RETARTED.
Reply
#15

Thank you Kush, this worked now fully!
Reply
#16

pawn Код:
CMD:energy(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
    {
        SendClientMessage(playerid, 0x0022FFFF, "You are not an administrator, so you can't use this command!");
        return 1;
    }
    SetPlayerHealth(playerid, 100);
    SendClientMessage(playerid, COLOR_GREY, "Health has been restored to 100.");
    return 1;
}
Does that work?

EDIT: I'm slow, very, very slow.
Reply
#17

Quote:
Originally Posted by Beanz
Посмотреть сообщение
pawn Код:
CMD:energy(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
    {
        SendClientMessage(playerid, 0x0022FFFF, "You are not an administrator, so you can't use this command!");
        return 1;
    }
    SetPlayerHealth(playerid, 100);
    SendClientMessage(playerid, COLOR_GREY, "Health has been restored to 100.");
    return 1;
}
Does that work?

EDIT: I'm slow, very, very slow.
Indeed you are
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)