Checking INT of key in MYSQL.
#1

Hello.

I want to show you my script if it's okay or there's any easy way that you can tell me.
By the way, It's working for me, but if there another easy way, it will help me.

Details:
I checked the INT of the key `Parked` in mysql, if this is -1, the vehicle didn't respawn, and if its 0+,
the vehicle had been respawned untill the next server restart and then it's find the XYZ of my vehicle.
In ongamemodeinit I did that it will be Parked=-1 automatically.

There's another easy and fast way? script: *Again, the code is working.
PHP код:
            new loadstrp[128], Float:VPos[3];
            
cmd strtok(cmdtextidx);
            
format(querysizeof(query), "SELECT * FROM `vehicles` WHERE `VehicleID`='%d' AND `Owner`='%s'"strval(cmd)-1GetName(playerid));
            
mysql_query(query);
            
mysql_store_result();
            if(
mysql_retrieve_row()) mysql_fetch_field_row(loadstrp"Parked");
            
mysql_free_result();
            if(
strval(loadstrp) != -1)
            {
                
GetVehiclePos(strval(loadstrp), VPos[0], VPos[1], VPos[2]);
                
SetPlayerCheckpoint(playeridVPos[0], VPos[1], VPos[2], 2);
            }
            else 
SendClientMessage(playeridWhite"You're vehicle is parked."); 
I think I didn't understand the results between "SELECT * FROM" and "SELECT", if you can give me examples
I'll be happy.
Reply


Messages In This Thread
Checking INT of key in MYSQL. - by Activest - 01.02.2013, 14:19
Re: Checking INT of key in MYSQL. - by Activest - 01.02.2013, 14:57

Forum Jump:


Users browsing this thread: 1 Guest(s)