Command 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: Command Help (
/showthread.php?tid=438738)
Command Help -
TylerJc - 21.05.2013
Hi! I'd like this to work as /car boot (It will open the boot)
Heres what i have
so far, the IsBootOpen and that are fine, don't worry about them.
I'm just getting this compiling error
Код HTML:
C:\Users\*****\Desktop\Gear\Games\GTA SA\GTA Server\filterscripts\Tyler.pwn(794) : error 033: array must be indexed (variable "tmp")
C:\Users\*****\Desktop\Gear\Games\GTA SA\GTA Server\filterscripts\Tyler.pwn(798) : error 033: array must be indexed (variable "tmp")
C:\Users\*****\Desktop\Gear\Games\GTA SA\GTA Server\filterscripts\Tyler.pwn(802) : error 033: array must be indexed (variable "tmp")
Re: Command Help -
Face9000 - 21.05.2013
Why using strcmp? Go for zcmd.
Re: Command Help -
TylerJc - 21.05.2013
Quote:
Originally Posted by Face9000
Why using strcmp? Go for zcmd.
|
I tried that but that still didn't work.
Re: Command Help -
TylerJc - 21.05.2013
Bump - anyone?
Re: Command Help -
Hawky133 - 22.05.2013
Hello.
Your variable
tmp is any array, or you could call it a string in this case.
To check if a string variable is equal to a value, you need to use the function
strcmp.
Here is the SA:MP wiki page on the function.
You basically need to replace the lines:
pawn Код:
if(tmp == "boot"){
...
} else if(tmp == "bonnet"){
...
} else if(tmp == "alarm"){
With:
pawn Код:
if(!strcmp(tmp,"boot",true)){
...
} else if(!strcmp(tmp,"bonnet",true)){
...
} else if(!strcmp(tmp,"alarm",true)){
Hopefully the wiki will answer your questions on how to use
strcmp, but if not, feel free to reply here.
Also, I'd recommend researching and learning to use one of these command systems (like ZCMD) that the person above recommended, as they run a lot quicker.
Re: Command Help -
TylerJc - 22.05.2013
Quote:
Originally Posted by Hawky133
Hello.
Your variable tmp is any array, or you could call it a string in this case.
To check if a string variable is equal to a value, you need to use the function strcmp.
Here is the SA:MP wiki page on the function.
You basically need to replace the lines:
pawn Код:
if(tmp == "boot"){ ... } else if(tmp == "bonnet"){ ... } else if(tmp == "alarm"){
With:
pawn Код:
if(!strcmp(tmp,"boot",true)){ ... } else if(!strcmp(tmp,"bonnet",true)){ ... } else if(!strcmp(tmp,"alarm",true)){
Hopefully the wiki will answer your questions on how to use strcmp, but if not, feel free to reply here.
Also, I'd recommend researching and learning to use one of these command systems (like ZCMD) that the person above recommended, as they run a lot quicker.
|
Thanks man, Really helped! +Rep