How to make command ''pm'' trough zcmd
#1

CMDm(playerid, params[]) {
if(isnull(params)) {
SendClientMessage(playerid, 0xFF0000FF, "Usage: /pm [ID/Part of name] [Text]");
} else {
// i need help what to write here!
return 1;
}
Reply
#2

sscanf2 + zcmd

pawn Код:
CMD:pm(playerid, params[])
{
    new PID, pName[MAX_PLAYER_NAME], Sender[MAX_PLAYER_NAME];
    if(sscanf(params, "us[128]", PID, params)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /PM < PlayerID > < Message >");
    if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, 0xFF0000FF, "That user is not connected!");
    new Str[128];

    GetPlayerName(PID, pName, sizeof(pName));
    GetPlayerName(playerid, Sender, sizeof(Sender));

    format(Str, sizeof(Str), "PM From: %s(%d): %s", Sender, playerid, params);
    SendClientMessage(PID, 0xFF0000FF, Str);
 
    format(Str, sizeof(Str), "PM Sent To: %s(%d): %s", pName, PID, params);
    SendClientMessage(playerid, 0xFF0000FF, Str);
    return 1;
}
You might get some errors + warnings ( i'm sleepy )
Reply
#3

ok thanks anyway...
Reply
#4

yea it worked... no errors and no warnings! thanx!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)