strfind problem
#4

Assuming garageid is an integer this:

Код:
switch(strval(garageid))
{
	case 1://player have typed 1
	{
	    //your code
	}
	case 2://player have typed 2
	{
	    //your code
	}
	default://mkae use of this when the player have typed an invalid number
}
would not work because strval is reading an int value out of a string (array) - which garageid just isn't.

A proper way would be getting the int value from the delimited cmdtext (strtok, dcmd) and put that value into the switch (so basically strval(cmd) instead of strval(garageid) - assuming strtok or dcmd and "cmd" containing the value as string).

Theoretically strfind does work for this too, just that it would detect "/checkgarageaddrandomtexthere" as "/checkgarage", since it contains "/checkgarage".

TiXz0r, look for command processors on the forums and maybe some tutorials, they explain the differences between the methods very well.
Reply


Messages In This Thread
strfind problem - by TiXz0r - 04.05.2015, 22:47
Re: strfind problem - by Gammix - 05.05.2015, 03:09
Re: strfind problem - by Threshold - 05.05.2015, 03:29
AW: strfind problem - by NaS - 05.05.2015, 04:35
Re: AW: strfind problem - by Gammix - 05.05.2015, 04:57
Re: strfind problem - by TiXz0r - 05.05.2015, 12:31
AW: Re: AW: strfind problem - by NaS - 05.05.2015, 13:26
Re: strfind problem - by TiXz0r - 05.05.2015, 13:52
Re: strfind problem - by MP2 - 05.05.2015, 13:55
Re: strfind problem - by TiXz0r - 05.05.2015, 13:59

Forum Jump:


Users browsing this thread: 2 Guest(s)