SA-MP Forums Archive
Hello I have problems with command converting.... Please help - 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: Hello I have problems with command converting.... Please help (/showthread.php?tid=373544)



Hello I have problems with command converting.... Please help - Scrillex - 30.08.2012

Код:
error 017: undefined symbol "tmp"
error 017: undefined symbol "cmdtext"
error 017: undefined symbol "tmp"
error 017: undefined symbol "tmp"
error 017: undefined symbol "tmp"
error 017: undefined symbol "cmdtext"
error 017: undefined symbol "string"
error 017: undefined symbol "string"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
fatal error 107: too many error messages on one line
Код:
CMD:spam(playerid,params[])
{
	if(AccInfo[playerid][Level] >= 5)
	{
 		tmp = strtok(cmdtext, idx);//this line first 2 errors
		if(!strlen(tmp))//next error
		{
			SendClientMessage(playerid, LIGHTBLUE2, "Usage: /spam [Colour] [Text]");
			SendClientMessage(playerid, orange, "Colours: [0]Black, [1]White, [2]Red, [3]Orange, [4]Yellow, [5]Green, [6]Blue, [7]Purple, [8]Brown, [9]Pink");
   			SendClientMessage(playerid, orange, "Function: Will sending many messages in chat in specified Colour");
			return 1;
		}
		new Colour = strval(tmp);//This error
		if(Colour > 9 )
		return SendClientMessage(playerid, red, "Colours: [0]Black, [1]White, [2]Red, [3]Orange, [4]Yellow, [5]Green, [6]Blue, [7]Purple, [8]Brown, [9]Pink");
		tmp = strtok(cmdtext, idx);//next 2 errors!!

		format(string,sizeof(string),"%s",cmdtext[8]);//next 5 errors!! 

		if(Colour == 0) 	 for(new i; i < 50; i++) SendClientMessageToAll(black,string);
		else if(Colour == 1) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_WHITE,string);
	 	else if(Colour == 2) for(new i; i < 50; i++) SendClientMessageToAll(red,string);
 	   	else if(Colour == 3) for(new i; i < 50; i++) SendClientMessageToAll(orange,string);
     	else if(Colour == 4) for(new i; i < 50; i++) SendClientMessageToAll(yellow,string);
 	   	else if(Colour == 5) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_GREEN1,string);
 	  	else if(Colour == 6) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_BLUE,string);
  	 	else if(Colour == 7) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_PURPLE,string);
    	else if(Colour == 8) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_BROWN,string);
    	else if(Colour == 9) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_PINK,string);
		return 1;
	}
	else return ErrorMessages(playerid, 9);
}
Please help me out with this


Re: Hello I have problems with command converting.... Please help - _Khaled_ - 30.08.2012

Just add these on the top of the command
pawn Код:
CMD:spam(playerid,params[])
{
   new tmp;
   new string[128];
}
For Cmdtext, don't know :\


Re: Hello I have problems with command converting.... Please help - Scrillex - 30.08.2012

Thanks for that Just need to think whats the next errors.. but anyway + rep


Re: Hello I have problems with command converting.... Please help - Killer#Mummy - 30.08.2012

replace cmdtext with params


Re: Hello I have problems with command converting.... Please help - Scrillex - 30.08.2012

Yeah thanks all done thanks mates for helping me out.. Just I love ****** and good persons


Re: Hello I have problems with command converting.... Please help - _Khaled_ - 30.08.2012

It's okay, anytime


Re: Hello I have problems with command converting.... Please help - Tika Spic - 31.08.2012

Well if you are using sscanf maybe like this?

Код:
CMD:spam(playerid,params[])
{
	if(AccInfo[playerid][Level] >= 5)
	{
		if(sscanf(params, "is[128]",Colour,text))
		{
			SendClientMessage(playerid, LIGHTBLUE2, "Usage: /spam [Colour] [Text]");
			SendClientMessage(playerid, orange, "Colours: [0]Black, [1]White, [2]Red, [3]Orange, [4]Yellow, [5]Green, [6]Blue, [7]Purple, [8]Brown, [9]Pink");
   			SendClientMessage(playerid, orange, "Function: Will sending many messages in chat in specified Colour");
			return 1;
		}
		if(Colour > 9 )
		return SendClientMessage(playerid, red, "Colours: [0]Black, [1]White, [2]Red, [3]Orange, [4]Yellow, [5]Green, [6]Blue, [7]Purple, [8]Brown, [9]Pink");
		new str[128];
		format(string,sizeof(string),"%s",text);/

		if(Colour == 0) 	 for(new i; i < 50; i++) SendClientMessageToAll(black,string);
		else if(Colour == 1) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_WHITE,string);
	 	else if(Colour == 2) for(new i; i < 50; i++) SendClientMessageToAll(red,string);
 	   	else if(Colour == 3) for(new i; i < 50; i++) SendClientMessageToAll(orange,string);
     	else if(Colour == 4) for(new i; i < 50; i++) SendClientMessageToAll(yellow,string);
 	   	else if(Colour == 5) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_GREEN1,string);
 	  	else if(Colour == 6) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_BLUE,string);
  	 	else if(Colour == 7) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_PURPLE,string);
    	else if(Colour == 8) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_BROWN,string);
    	else if(Colour == 9) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_PINK,string);
		return 1;
	}
	else return ErrorMessages(playerid, 9);
}
if not sorry for posting