05.01.2011, 03:19
Hi i was on wiki and found a /pm code, but it didnt work for me, can some of you guys show me one?
public OnPlayerCommandText(playerid cmdtext[])
{
dcmd(pm, 2, cmdtext);
return 0;
}
dcmd_pm(playerid,params[])
{
new
pmtext[128],
pID;
if(sscanf(params,"ds",pID,pmtext)) {
return SendClientMessage(playerid,COLOR_RED,"USAGE: /pm [playerid] [text]");
}
if(!IsPlayerConnected(pID)) {
return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID");
}
new
name[MAX_PLAYER_NAME],pmname[MAX_PLAYER_NAME],
string[128],string2[128];
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(pID,pmname,sizeof(pmname));
if(GetPlayerName(pID, pmname, sizeof(pmname)) == GetPlayerName(playerid, name, sizeof(name))){
return SendClientMessage(playerid, COLOR_RED, "You cannot send a PM to yourself!");
}
format(string,sizeof(string),"PM sent to %s(%d) : %s ", pmname, pID, pmtext);
format(string2,sizeof(string2),"PM from %s(%d) : %s", name, playerid, pmtext);
SendClientMessage(playerid,COLOR_PMY,string);
SendClientMessage(pID,COLOR_PMY,string2);
return 1;
}
Hey, found this tut, havn't tryed it tho but it looks good.
https://sampforum.blast.hk/showthread.php?tid=164500 |