SA-MP Forums Archive
help - 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)
+--- Thread: help (/showthread.php?tid=525867)



help - saffierr - 14.07.2014

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


Re: help - Stinged - 14.07.2014

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



Re: help - Jstylezzz - 14.07.2014

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.


Re: help - Jack_Leslie - 14.07.2014

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


Re: help - saffierr - 14.07.2014

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


Re: help - Jack_Leslie - 14.07.2014

Use the codes that have been posted above


Re: help - saffierr - 14.07.2014

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


Re: help - Jack_Leslie - 14.07.2014

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



Re: help - Stinged - 14.07.2014

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


Re: help - saffierr - 14.07.2014

I already Fixed this.