21.07.2016, 17:09
(
Последний раз редактировалось ThatThoseTheThy; 21.07.2016 в 18:05.
)
Hello there,
I am creating a PM command from various links I mash together. For some weird reason when I get in game and pm someone something it does this:
It shows the ID of the player you are sending to and then the message you wanted.
Thanks in advance
I am creating a PM command from various links I mash together. For some weird reason when I get in game and pm someone something it does this:
It shows the ID of the player you are sending to and then the message you wanted.
PHP код:
#define FILTERSCRIPT
#include <a_samp>
#include <sscanf>
#include <zcmd>
enum PlayerInfo
{
Last,
NoPM,
}
new pInfo[MAX_PLAYERS][PlayerInfo];
//Usual OnFilterScript things are empty and so on
public OnPlayerConnect(playerid)
{
pInfo[playerid][Last] = -1;
pInfo[playerid][NoPM] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
pInfo[playerid][Last] = -1;
pInfo[playerid][NoPM] = 0;
return 1;
}
CMD:pm(playerid, params[])
{
new id, msg[128], text[128];
if(sscanf(params, "s[128]", msg) || sscanf(params, "u", id)) return SendClientMessage(playerid, RED, "[USAGE]: /pm [name/id] [msg]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, RED, "Player not found.");
if(strlen(msg) < 1 || strlen(msg) > 128) return SendClientMessage(playerid, RED, "Your message can only contain 1-128 characters.");
if(playerid == id) return SendClientMessage(playerid, RED, "You cannot PM yourself.");
if(pInfo[id][NoPM] == 1) return SendClientMessage(playerid,-1,"That player isnt recieving pm's");
format(text, sizeof(text), "PM To %s : %s", PlayerName(id), msg);
SendClientMessage(playerid, YELLOW, text);
format(text, sizeof(text), "PM From %s : %s", PlayerName(playerid), msg);
SendClientMessage(id, YELLOW, text);
pInfo[id][Last] = playerid;
return true;
}
stock PlayerName(playerid)//Executing function.
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
return pName;
}
Thanks in advance