SA-MP Forums Archive
Switch the inputtext. - 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: Switch the inputtext. (/showthread.php?tid=329600)



Switch the inputtext. - BetaLaxx - 29.03.2012

pawn Код:
switch(inputtext)
                {
pawn Код:
C:\Users\X_Zerd\Desktop\Samp 0.3e\samp03e_svr_RC5_win32\gamemodes\O-RP.pwn(2343) : error 033: array must be indexed (variable "-unknown-")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



Re: Switch the inputtext. - ReneG - 29.03.2012

A switch statement is only for integers. inputtext is a string, therefore it cannot be used in a switch statement.
Click here to learn how to use them.


Re: Switch the inputtext. - BetaLaxx - 29.03.2012

pawn Код:
switch(inputtext[3])
                {
pawn Код:
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase

"?"


Re: Switch the inputtext. - T0pAz - 29.03.2012

Check out this tutorial. It explains how to use switch statement for strings.


Re: Switch the inputtext. - ReneG - 29.03.2012

Wow, cool tutorial Topaz, was not aware you could do this.


Re: Switch the inputtext. - BetaLaxx - 30.03.2012

Yep, That was unexpected, Thanks.