How to check if the result is 1? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to check if the result is 1? (
/showthread.php?tid=186499)
How to check if the result is 1? -
ajwar - 29.10.2010
I want to check if it's locked, but it won't go.
mysql_get_field( "Locked", vInfo[ vInfo[ vehicleid ][ Id ] ][ Locked ] );
I tryed
if(vInfo[ vInfo[ vehicleid ][ Id ] ][ Locked ] == 1 )
But it won't work. In the log i can see that it get's the right result. Should i use strval ? How should i do?
Re: How to check if the result is 1? -
Cameltoe - 29.10.2010
You could make an stock:
pawn Код:
stock IsVehicleLocked(vehicleid)
{
if(vInfo[vehicleid][Locked] == 1) return 1;
return 0;
}
How to use it:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(IsVehicleLocked(vehicleid))
{
// Do shit if the vehicle is locked.
}
}
Btw, you might want to check out my fresh tutorial
https://sampforum.blast.hk/showthread.php?tid=186495
Re: How to check if the result is 1? -
ajwar - 29.10.2010
Is it possible to do it simply without stock ?
Re: How to check if the result is 1? -
Cameltoe - 29.10.2010
Never ever used mysql_fetch_field before.. though i'm sure this will work.
pawn Код:
new Lockedvehicle[10];
mysql_fetch_field("FieldName", LockedVehicle);
printf("%s",LockedVehicle);
vInfo[vehicleid][Locked] = strval(LockedVehicle);
printf("%d",vInfo[vehicleid][Locked);
EDIT: The prints is to debug btw.
Re: How to check if the result is 1? -
ajwar - 29.10.2010
Thank's.