Admin chat won't allow spaces - 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: Admin chat won't allow spaces (
/showthread.php?tid=372355)
Admin chat won't allow spaces -
jueix - 26.08.2012
Ok so i made a simple admin chat and it works but if a player types with spaces it dosn't show the words after the spaces here is my code.
pawn Код:
COMMAND:ac(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] > 1)
{
new message[200];
if(sscanf(params, "s[32]", message))
{
new string1[252];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(string1,sizeof(string1),"Server Admin %s: %s", pname, message);
SendMessageToAdmins(COLOR_GREEN,string1);
}
else return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /ac [message]");
}
else return SendClientMessage(playerid, COLOR_YELLOW, "You are not an admin");
return 1;
}
Re: Admin chat won't allow spaces -
Sniper Kitty - 26.08.2012
s[32]
should be
s[200]
Re: Admin chat won't allow spaces -
Dan. - 26.08.2012
Yeah and you shouldn't make your string so big. When you have a lot of command functions etc. it will start to get a bit slower, the max clientmessage is 144 long, your reason and the other string are 400+ together. But yes, Sniper Kitty pointed out the problem.
Re: Admin chat won't allow spaces -
leonardo1434 - 26.08.2012
pawn Код:
COMMAND:ac(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, COLOR_YELLOW, "You are not an admin");
new message[128];
if(sscanf(params, "s[128]", message)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /ac [message]");
new pname[MAX_PLAYER_NAME],str[sizeof message];
GetPlayerName(playerid,pname,sizeof(pname));
format(str,sizeof(str),"Server Admin %s: %s", pname, message);
SendMessageToAdmins(COLOR_GREEN,str);
return 1;
}
Re: Admin chat won't allow spaces -
jueix - 26.08.2012
ok i changed s[32] to s[200] and still dosn't show words after spaces
Re: Admin chat won't allow spaces -
jueix - 26.08.2012
Quote:
Originally Posted by leonardo1434
pawn Код:
COMMAND:ac(playerid, params[]) { if(PlayerInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, COLOR_YELLOW, "You are not an admin"); new message[128]; if(sscanf(params, "s[128]", message)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /ac [message]"); new pname[MAX_PLAYER_NAME],str[sizeof message]; GetPlayerName(playerid,pname,sizeof(pname)); format(str,sizeof(str),"Server Admin %s: %s", pname, message); SendMessageToAdmins(COLOR_GREEN,str); return 1; }
|
when i do that one it just says /ac message