Give another player a Message
#1

Hello,
I'm trying to make a "/rights" Command where if you /rights [PlayerID] it reads them their rights. I have no idea on how to do this, can someone help me out?
Reply
#2

https://sampwiki.blast.hk/wiki/SendClientMessage
Inside the command
Reply
#3

Use sscanf, it's pretty simple really.

pawn Код:
COMMAND:rights(playerid, params[])
{
    new TargetID;
    if(sscanf(params, "u", TargetID)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /rights [playerid]");
   
    if(TargetID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invalid player ID!");
   
    SendClientMessage(TargetID, COLOR_WHITE, "rights"); // Rights :P
    return 1;
}
A really basic example of how you could do it, but obviously you'd have to change it so that only certain people could do it, etc. If you wanted it to come out in local chat (usually default chat in RP servers), then it'd be pretty easy to implement it into that. But if you just want to send it to the target, then use that.
Reply
#4

thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)