SA-MP Forums Archive
sscanf text invisible - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: sscanf text invisible (/showthread.php?tid=611387)



sscanf text invisible - Eymeric69 - 05.07.2016

FIXED


Re: sscanf text invisible - Sawalha - 05.07.2016

you formatted the "string" variable, not the string2, "string" variable is supposed to represent be the string parameter in the command, and string2 is supposed to be the final string to send to the player desired.

Код:
CMD:pm(playerid, params[]) 
{ 
    new cibleid, string[128], pName[MAX_PLAYER_NAME], string2[128]; 
    if(sscanf(params, "us", cibleid, string)) return SendClientMessage(playerid, COULEUR_ROUGE,"Usage: /pm [id] [message]"); 
    if(!IsPlayerConnected(cibleid)) return SendClientMessage(playerid, COULEUR_ROUGE,"[ERROR] This Player is not connected"); 
    GetPlayerName(playerid, pName, sizeof(pName)); 
    format(string2, sizeof(string2), "PM of %s: %s", pName, string); 
    SendClientMessage(cibleid, COULEUR_JAUNE, string2); 
    SendClientMessage(playerid, COULEUR_BLEUCLAIR ,"Message envoyйe."); 
    return 1; 
}



Re: sscanf text invisible - Eymeric69 - 05.07.2016

Oh sorry i haven't seen that thanks.


Re: sscanf text invisible - Konstantinos - 05.07.2016

"s" specifier needs the size specified as "s[size_here]" otherwise you'll get sscanf warning: Arrays without a length are deprecated, please add a destination size.