#1

I scripted a few cmds but, a example
Quote:

CMD:armour(playerid, params[])
{
if (IsPlayerAdmin(playerid))
SetPlayerArmour(playerid, 100.00); return SendClientMessage(playerid, -1, "You Succesfully used armour.");
return 1;
}

When I do /armour even I am not logged in as a admin, a Message appears "You Succesfully used armour." but Armour doesn't come becuase he is not admin, I hope someone can help me how to, when a random player types /armour it says "SERVER:UNKNOWN COMMAND". because if a random players now types /armour it says "You Succesfully used armour." wich is not true
Reply
#2

I think the way you script is bugging them.
Can you try this?

pawn Код:
CMD:armour(playerid, params[])
{
    if (!IsPlayerAdmin(playerid))
        return 0;
       
    SetPlayerArmour(playerid, 100.0);
    SendClientMessage(playerid, -1, "You successfully used armour.");
    return 1;
}
Reply
#3

Try
pawn Код:
CMD:armour(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return 0; //If the player is not admin show 'unknown command'
    SendClientMessage(playerid,-1,"You've sucessfully used armour!");
    SetPlayerArmour(playerid,100.0);
    return 1;
}
EDIT: Stinged beat me to it :P
EDIT2: The reason that I used return 0 after IsPlayerAdmin, and did not use SendClientMessage, is simply because the normal players don't have to know that the command exists.
Reply
#4

So, do you want everyone to use the command, or just admins?
Reply
#5

just admins, and when I put a ! infront of everyone can use it. I dont want that
Reply
#6

Use the codes that have been posted above
Reply
#7

The code does not work properly, I think because its return 0; , and thanks to that any player can type /armour to use armour
Reply
#8

pawn Код:
CMD:armour(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COL_RED, "You aren't an Admin.");
    SendClientMessage(playerid,-1,"You've sucessfully used armour!");
    SetPlayerArmour(playerid,100.0);
    return 1;
}
Reply
#9

the return 0; after if (!IsPlayerAdmin(playerid)) returns the normal unknown command error. It has nothing to do with the problem you're having.
Reply
#10

I already Fixed this.
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)