UC cmd
#1

Alright, I am planning to make a command that will set the players admin to 4 which will turn them undercover.

I want it to work this way:

/command (password)

Код:
CMD:pppucucuc(playerid,params[])
{
    SendClientMessage(id,RED,"You are undercover.");
	PlayerInfo[id][pAdmin] = 4;
	return 1;
}
It won't be stored at any place,simply,it will give an error when you type the command: /command default and the password is default,making your admin level 4. But if you do /command madness it will say invalid password!

So I want the password to be editable besides can be used by anyone at any situation. If you write the wrong password it will give you an error.

Thanks
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=187229
Reply
#3

Bump
Reply
#4

Do you want create commands with Parameters?
It's simple, if you use sscanf.
pawn Код:
CMD:akill(playerid,params[])
{
    new id; // We create a variable, to save target players ID.
    // Player has used the command /akill, but without params.
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /akill (playerid)");
    // We check is the target player connected or not.
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "Player is not connected.");
    SetPlayerHealth(id, 0);
    return 1;
}
Here's an example again, but now with string and without sscanf.
pawn Код:
CMD:announce(playerid, params[])
{
    if(!strlen(params)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /announce (text)");
    GameTextForAll(params, 4000, 3);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)