SA-MP Forums Archive
View Vehicle not working properly - 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: View Vehicle not working properly (/showthread.php?tid=612059)



View Vehicle not working properly - GoldenLion - 13.07.2016

Hi, I added "View Vehicle" to MDC in my gamemode recently along with license plate system. Each car has it's own license plate. Everything works fine except the View Vehicle thing. It works, but not properly. If I type in my car's license plate, it gives me the information of any other car, but when I type any other license plate then it shows the information of my car. I don't understand what am I doing wrong. Here's the code:
Код:
code removed, i don't want to release it :P
I'm using South Central Roleplay script, all functions are there.


Re: View Vehicle not working properly - Mencent - 13.07.2016

Hello!

PHP код:
if (strcmp(CarData[carid][carPlate], inputtext)) 
to
PHP код:
if (!strcmp(CarData[carid][carPlate], inputtext)) 
Does it work?


Re: View Vehicle not working properly - GoldenLion - 13.07.2016

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello!

PHP код:
if (strcmp(CarData[carid][carPlate], inputtext)) 
to
PHP код:
if (!strcmp(CarData[carid][carPlate], inputtext)) 
Does it work?
Oh yeah, thank you. I thought that there must not be a "!".


Re: View Vehicle not working properly - Mencent - 13.07.2016

When strcmp returns 0 (so with "!") then the both strings are the same. When it's higher as 0 (without "!") then they are not the same.


Re: View Vehicle not working properly - GoldenLion - 13.07.2016

Quote:
Originally Posted by Mencent
Посмотреть сообщение
When strcmp returns 0 (so with "!") then the both strings are the same. When it's higher as 0 (without "!") then they are not the same.
Yep, thanks.