28.08.2010, 15:15
Quote:
Bom, 1є precisariamos do seu code de PM, mais aqui vai mais ou menos, deduzindo as variaveis:
pawn Код:
|
pawn Код:
new recieverid;
new h, mi, s;
new y1, m, d;
gettime(h,mi,s);
getdate(y1, m, d);
new string[256];
new cmd[256];
new tmp[256];
new Message[256];
new gMessage[256];
new pName[70];
new temp[256];
new iName[70];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp("/pm", cmd, true) == 0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || strlen(tmp) > 5) {
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (mensagem)");
return 1;
}
new id = strval(tmp);
gMessage = strrest(cmdtext,idx);
if(!strlen(gMessage)) {
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (mensagem)");
return 1;
}
if(!IsPlayerConnected(id)) {
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/pm : ID Errado");
return 1;
}
if(playerid != id) {
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pName,sizeof(pName));
format(Message,sizeof(Message),"PM enviado para %s(%d): %s",iName,id,gMessage);
GameTextForPlayer(id, "~w~MENSAGEM ENVIADA", 5000, 5);
SendClientMessage(playerid,PM_OUTGOING_COLOR,Message);
format(Message,sizeof(Message),"PM recebido de %s(%d): %s",pName,playerid,gMessage);
GameTextForPlayer(id, "~w~MENSAGEM RECEBIDA", 5000, 5);
SendClientMessage(id,PM_INCOMING_COLOR,Message);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
format(string, sizeof(string), "[Data:%d/%d/%d] [Hora:%d:%d:%d] PM de %s para %s: %s",d,m,y1,h,mi,s, pName,iName, gMessage);
PMLog(string);
printf("PM: %s",Message);
}else {
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"[ERRO]: Vocк nгo pode mandar pm pra vocк mesmo.");
}
if(showpm){
format(string, sizeof(string), "[PM]: %s mandou pm para %s: %s" , pName, iName, gMessage);
SendPMToAdmins(0x00ffaaFF, string, 3);
}
return 1;
}