Help with a PM command (ZCMD)
#1

Hey im needing a little help with a PM system could I get a basic code please it would be appriciated
Reply
#2

Use the search button next time.
https://sampforum.blast.hk/showthread.php?tid=291063
https://sampforum.blast.hk/showthread.php?tid=395318
Reply
#3

CLICK


Here you go
Reply
#4

pawn Код:
CMD:pm(playerid, params[])
{
    new playerb, string[128], text[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 0) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
    if(sscanf(params, "us[128]", playerb, text)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pm [playerid] [text]");
    if(AntiAdv(playerid, params)) return 1;
    if(!strlen(text)) return SendClientMessage(playerid, COLOR_GREY, "You haven't entered any text to PM.");
    if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    format(string, sizeof(string), "PM to %s: %s", RPN(playerb), text);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    format(string, sizeof(string), "PM from %s: %s", RPN(playerid), text);
    SendClientMessage(playerb, COLOR_YELLOW, string);
    format(string, sizeof(string), "PM from %s to %s: %s", RPN(playerid), RPN(playerb), text);
    Log("logs/pm.log", string);
    foreach(Player, i)
    {
        if(PlayerInfo[i][pAdmin] >= 6 && PMs[i] && i != playerid && i != playerb)
        {
            format(string, sizeof(string), "[PM] %s to %s: %s", RPN(playerid), RPN(playerb), text);
            SendClientMessage(i, COLOR_YELLOW, string);
        }
    }
    return 1;
}
Reply
#5

PHP код:
#define COLOR_YELLOW 0xEAEA15C8
#define NO_PARAMS 0xBEBCD3FF
CMD:pm(playeridparams[])
{
    new 
string[256], text[128], targetid;
    if(
sscanf(params"rs[128]"targetidtext)) return SendClientMessage(playeridNO_PARAMS"USAGE: /pm [Id or name] [text]");//If no enough params
    
if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playeridERROR"ERROR: Invalid player ID or Name");//If player wants to PM him self or a not connected player
    
if(targetid == playerid)  return SendClientMessage(playeridERROR"ERROR: You cannot PM yourself");
    
format(stringsizeof(string), "PM from: %s |Text: %s"Name(playerid), text);//The format of the string
    
SendClientMessage(targetidCOLOR_YELLOWstring);//sending the message to the targetid
    
format(stringsizeof(string), "PM to: %s| Text: %s"Name(targetid), text);
    
SendClientMessage(playeridCOLOR_YELLOWstring);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)