SA-MP Forums Archive
reason wont appear on chat - 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: reason wont appear on chat (/showthread.php?tid=649401)



reason wont appear on chat - ivndosos - 08.02.2018

I don't know why but when I mute someone it says

"You have muted (name here) for (nothing here)"



Код:
CMD:mute(playerid, params[])
{
    if(connected[playerid] == true) return GameTextForPlayer(playerid, "~r~Spawn First", 5000, 5);
    if(pInfo[playerid][Admin] < 1) return SendClientMessage(playerid, -1, "{C3C3C3}(INFO) You don't have the priviliges to use this command.");
	{
	   new target, str[128], name[MAX_PLAYER_NAME], reason[50];
	   if(Mute[target] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) That player is already muted!");
	   if(sscanf(params, "us[128]", target, str)) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) /mute [id] [reason]");
	   if(!IsPlayerConnected(target)) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) That player is not connected");
	   GetPlayerName(target, name,sizeof(name));
	   format(str, sizeof(str), "{EFB509}(INFO) You have muted %s for %s", name, reason);
	   SendClientMessage(playerid, -1, str);
	   
	   format(str, sizeof(str), "{EFB509}(INFO) You have been muted by an admin for: %s", reason);
	   SendClientMessage(target, -1, str);
	   GameTextForPlayer(playerid, "~r~Muted", 4000, 3);
	   Mute[target] = 1;
	}
	return 1;
}



Re: reason wont appear on chat - Mugala - 08.02.2018

you have a "str" as reason, so remove the reason[50]; and place str in formats (instead of reasons)
for example:
format(str, sizeof(str), "{EFB509}(INFO) You have muted %s for %s", name, str);

EDIT: noticed too late* u're using str as a main text, so just change if(sscanf(params, "us[128]", target, str)) this str into a reason
if(sscanf(params, "us[128]", target, reason))


Re: reason wont appear on chat - ivndosos - 08.02.2018

Quote:
Originally Posted by Mugalito
Посмотреть сообщение
you have a "str" as reason, so remove the reason[50]; and place str in formats (instead of reasons)
for example:
format(str, sizeof(str), "{EFB509}(INFO) You have muted %s for %s", name, str);

EDIT: noticed too late* u're using str as a main text, so just change if(sscanf(params, "us[128]", target, str)) this str into a reason
if(sscanf(params, "us[128]", target, reason))
haha thanks