29.09.2016, 12:48
Also mine is like that if you use ZCMD/IZCMD:
Include y_va from YSI is required for this following functions.
PHP код:
CMD:pm(playerid, params[])
{
new cible,
message[95];
if(sscanf(params,"us[95]", cible, message)) return SCM(playerid, LBLUE, "/pm [player_id/name] [message]");
if(!IsPlayerConnected(cible))
return ErrorMsg(playerid, _, "This player is not connected");
new temp = PmTime[playerid] - gettime();
if(PmTime[playerid] && PmTime[playerid] > gettime())
ErrorMsg(playerid, _, "You must wait %s sec before sending an another PM.", temp);
PmTime[playerid] = gettime() + TPS_PM;
SCMF(playerid, 0xffdd99ff, "[PM] Send to %s : %s", GetName(cible, true), message);
SCMF(cible, 0xffc34dff, "[PM] Recivied from %s : %s", GetName(playerid, true), message);
SendMessageToAdmins(SAUMON, "[Admin] %s » %s : '%s'", GetName(playerid, true), GetName(cible, true), message);
return 1;
}
PHP код:
SCMF(const playerid, couleur, const msg[], va_args<>)
{
new
string[145];
va_format(string, sizeof(string), msg, va_start<3>);
return SendClientMessage(playerid, couleur, string);
}
ErrorMsg(playerid, allowed = true, const msg[] = EOS, va_args<>)
{
new message[190];
static const premsg[] = "[Erreur] %s";
if(!allowed)
return SCMF(playerid, REDF, "[Error] You are not allowed to use this command.");
if(numargs() == 2)
return SCMF(playerid, REDF, premsg, msg);
va_format(message, sizeof(message), msg, va_start<3>);
return SCMF(playerid, REDF, "[Erreur] %s", message);
}
GetName(const playerid, id = false)
{
static str[MAX_PLAYER_NAME+9];
GetPlayerName(playerid, str, sizeof(str));
if(id) format(str, sizeof(str), "%s (ID: %i)", str, playerid);
return str;
}
SendMessageToAdmins(color, const msg[], va_args<>)
{
new
string1[190];
va_format(string1, sizeof(string1), msg, va_start<2>);
foreach(new i : Player)
{
if(pAccount[i][pAdmin] < 1) continue;
SCM(i, color, string1);
}
return 1;
}