21.04.2013, 07:33
PHP код:
CMD:sms(playerid, params[])
{
new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
if(sscanf(params, "us", id, str2))
{
SendClientMessage(playerid, 0xFF0000FF, "USAR: /sms <id> <mensaje>");
return 1;
}
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Usuario no conectado");
if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: No podes enviarte a ti mismo!");
{
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(id, Name2, sizeof(Name2));
format(str, sizeof(str), "SMS a %s(ID %d) enviado con exito!", Name2, id);
SendClientMessage(playerid, COLOR_GREEN, str);
format(str, sizeof(str), "SMS de %s(ID %d): %s", Name1, playerid, str2);
SendClientMessage(id, COLOR_GREEN, str);
}
return 1;
}
Код:
[04:44:09] sscanf warning: Strings without a length are deprecated, please add a destination size. [04:44:09] sscanf warning: String buffer overflow.