string &? switch - 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: string &? switch (
/showthread.php?tid=180374)
string &? switch -
GaGlets(R) - 01.10.2010
Hey i`m a bit confused now.
How can i switch string / use switch checking the string
pawn Code:
new name[15];
if(sscanf(params, "s[15]", name))
{
return 1;
}
format(name, 15,"%s",name);
switch(name)
{
case 'sell':
{
.......................
This is giving errors for me.
Do i need to use strcmp or smth like that?
Re: string &? switch -
samgreen - 01.10.2010
You cannot switch on a string in pawn, switch may only be used with integers. Also you don't need that format, sscanf formats name automatically. You will need to use strcmp and if/else if.
Re: string &? switch -
Kyosaur - 01.10.2010
You could do something like this:
http://forum.sa-mp.com/showthread.ph...ighlight=yhash.
Other than that you have to use strcmp to compare to strings together.
AW: string &? switch -
Bubelbub - 15.07.2012
*DELETED*