SA-MP Forums Archive
Car keys 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: Car keys help (/showthread.php?tid=607243)



Car keys help - TayFunCZE - 16.05.2016

Hello, I need help with this function:
PHP код:
if(!GetPVarInt(playerid,"CarKeys")==vehicleid) return SCM(playerid,RED,"You don't have keys from this vehicle!"); 
I've got this error:
PHP код:
warning 213tag mismatch 
Please, tell me what is bad in this code :/


Re: Car keys help - Konstantinos - 16.05.2016

Do you want to check if CarKeys is equal to 0 or vehicleid? You cannot check both like that.

pawn Код:
if (!GetPVarInt(playerid,"CarKeys")) // CarKeys == 0
// or
if (GetPVarInt(playerid,"CarKeys") == vehicleid) // CarKeys == vehicleid



Re: Car keys help - TayFunCZE - 16.05.2016

I want to check if player's PVarInt is same as vehicleid, but nice, this is working, thank you


Re: Car keys help - BornHuman - 16.05.2016

Quote:
Originally Posted by TayFunCZE
Посмотреть сообщение
I want to check if player's PVarInt is same as vehicleid, but nice, this is working, thank you
Try

pawn Код:
if(GetPVarInt(playerid,"CarKeys") != vehicleid) return SCM(playerid,RED,"You don't have keys from this vehicle!");
You can't use an '!' at the beginning of the if statement when you're comparing two variables. It's used in the control structure itself.