06.05.2014, 17:22
Hello guys, so i'm not good at sscanf, and can't figure out what i've done wrong. But whenever i make a pm, i get this error in my server log: scanf warning: Strings without a length are deprecated, please add a destination size.
Well I do know that i need to add a string some where, but where exactly?
Could anyone help? Thanks.
Code:
Well I do know that i need to add a string some where, but where exactly?
Could anyone help? Thanks.
Code:
PHP код:
CMD:pm(playerid, params[])
{
new pID, text[210], string[230];
if(sscanf(params, "us", pID, text)) return SendClientMessage(playerid, ERROR_COLOR, "USAGE: /pm (nick/id) (message) - Enter a valid Nick / ID");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, ERROR_COLOR, "Player is not connected.");
if(pID == playerid) return SendClientMessage(playerid, ERROR_COLOR, "You cannot PM yourself.");
format(string, sizeof(string), "%s (%d) is not accepting private messages at the moment.", GetName(pID), pID);
if(PlayerInfo[pID][NoPM] == 1) return SendClientMessage(playerid, ERROR_COLOR, string);
format(string, sizeof(string), "PM to %s: %s", GetName(pID), text);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "PM from %s: %s", GetName(playerid), text);
SendClientMessage(pID, COLOR_LIGHTBLUE, string);
PlayerInfo[pID][Last] = playerid;
return 1;
}
CMD:r(playerid, params[])
{
new text[128], string[128];
if(sscanf(params, "s", text)) return SendClientMessage(playerid, ERROR_COLOR, "USAGE: /r (message) - Enter your message");
new pID = PlayerInfo[playerid][Last];
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, ERROR_COLOR, "Player is not connected.");
if(pID == playerid) return SendClientMessage(playerid, ERROR_COLOR, "You cannot PM yourself.");
format(string, sizeof(string), "%s (%d) is not accepting private messages at the moment.", GetName(pID), pID);
if(PlayerInfo[pID][NoPM] == 1) return SendClientMessage(playerid, ERROR_COLOR, string);
format(string, sizeof(string), "PM to %s: %s", GetName(pID), text);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "PM from %s: %s", GetName(playerid), text);
SendClientMessage(pID, COLOR_LIGHTBLUE, string);
PlayerInfo[pID][Last] = playerid;
return 1;
}