SA-MP Forums Archive
A /pm Command please - 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: A /pm Command please (/showthread.php?tid=280986)



A /pm Command please - seanny - 03.09.2011

Hello, I want a /pm Command which an Admin can also Listen to for administrative Purposes

IT MUST BE IN EITHER STRCMP OR DCMD


Re: A /pm Command please - Dokins - 03.09.2011

edit: Not sure how to use Strcmp.


Re: A /pm Command please - BlackWolf120 - 03.09.2011

this is directly taken from my own script:

pawn Код:
//OnPlayerCommand
dcmd(pm,2,cmdtext);

//somewhere in ur script outside a callback
dcmd_pm(playerid,params[])
{
    new str[254],id,pnamer[24],pnames[24];
    if(sscanf(params, "ds[192]", id, params)) SendClientMessage(playerid, 0xFF0000FF, "{FFFF00}Usage: {855E42}/pm {FFFF00}[ID] [Message]");
    if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000FF, "{FFFF00}Invalid Player{855E42}ID!");
    if(playerid == id)return SendClientMessage(playerid, 0xFF0000FF, "{FFFF00}You cannot {855E42}PM {FFFF00}yourself!");

    GetPlayerName(id, pnamer, 24);
    format(str, sizeof(str), "{855E42}PM {FFFF00}to {3F9E4D}%s(%d): {FFFF00}%s", pnamer, id, params);
    SendClientMessage(playerid, 0xFF0000FF, str);
    GetPlayerName(playerid, pnames, 24);
    format(str, sizeof(str), "{855E42}PM {FFFF00}from {3F9E4D}%s(%d): {FFFF00}%s", pnames, playerid, params);
    SendClientMessage(id, 0xFF0000FF, str);
    PlayerPlaySound(id,1147,0, 0, 0);

    foreach(Player,i)//u need foreach or change it to the custom loop
    {
    if(Spieler[i][AdminLevel] > 2)//adjust this to ur variable
    {
    format(str, sizeof(str), "{FF00FF}PM Spoofed: {FFFF00}From {3F9E4D}%s to %s: {FFFF00}%s", pnames, pnamer , params);
    SendClientMessage(i, 0xFF0000FF, str);
    }
    }

    return 1;
}
@dokins: Come on dude ...


Re: A /pm Command please - seanny - 03.09.2011

@First Poster: Nvm

@Second Poster: Thank you, I'll add you to the credits


AW: A /pm Command please - Joshua_Turnerz - 03.09.2011

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


Re: A /pm Command please - BlackWolf120 - 03.09.2011

thx alot but u dont need to add me to the credits, im happy i could help