SA-MP Forums Archive
/freeze command error - 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: /freeze command error (/showthread.php?tid=642141)



/freeze command error - Escobabe - 25.09.2017

Код:
CMD:freeze(playerid,params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		new id;
		if(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,"USAGE: /freeze [ID]");
		if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"That player is not connected");
		new str[100]
		format(str,sizeof(str),"You have been frozen by an admin.", id); --> Error line.
		SendClientMessage(id, COLOR_RED, str);
		TogglePlayerControllable(id,0);
	}
	return 1;
}
Код:
error 001: expected token: ";", but found "-identifier-"
What am i doing wrong here?


Re: /freeze command error - 10MIN - 25.09.2017

PHP код:
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"That player is not connected");
        new 
str[100//<-- NO SEMICOLON HERE!
        
format(str,sizeof(str),"You have been frozen by an admin."id); --> Error line
Solved:
PHP код:
new str[100]; //<-- SEMICOLON IS HERE 



Re: /freeze command error - Escobabe - 25.09.2017

Quote:
Originally Posted by 10MIN
Посмотреть сообщение
PHP код:
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"That player is not connected");
        new 
str[100//<-- NO SEMICOLON HERE!
        
format(str,sizeof(str),"You have been frozen by an admin."id); --> Error line
Solved:
PHP код:
new str[100]; //<-- SEMICOLON IS HERE 
Damn, a huge miss i made. Thank you +rep.

EDIT: You must spread some Reputation around before giving it to 10MIN again.