18.05.2016, 12:04
Quote:
Код:
CMD:viptext(playerid, params[]) { static Text[300], str[350]; if(GetPVarInt(playerid,"DonateRank") >= 1) return SendClientMessage(playerid, 0xFFFFFF, "You dont have any donator rank"); if (sscanf(params, "s[300]", Text)) return SendClientMessage(playerid, 0xFFFFFF, "/viptext[text]"); for(new i=0; i < MAX_PLAYERS; i++) { format(str, sizeof(str), "[VIP CHAT] %s Says: %s", GetName(playerid), Text); SendClientMessage(i, 0xFFFFFF, str); } return 1; } |
Quote:
You shouldn't use sscanf when you only want to use the params as a string, and especially not a string with 300 cells. And you shouldn't create two different strings if you only want to use 1 at a time.
Recycle the same one (Not sure if that's the correct term but meh) SendClientMessage can only show 128 characters, why would you even need a string with 350 cells.. Код:
CMD:v(playerid, params[]) { if(GetPVarInt(playerid, "DonateRank") >= 1) { if (isnull(params)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /v text"); for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(GetPVarInt(i, "DonateRank") >= 1) { new str[128]; format(str, sizeof(str), "[VIP CHAT] %s Says: %s", GetName(playerid), params); SendClientMessage(i, 0xFFFFFFFF, str); } } } } else SendClientMessage(playerid, 0xFFFFFFFF, "You dont have any donator rank"); return 1; } |