SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 07/03/2012, 02:09 AM   #1
2KY
Gangsta
 
2KY's Avatar
 
Join Date: Jan 2012
Location: United States
Posts: 950
Reputation: 166
Default OnGameModeExit problems.

Why does this reset all values to 0.0?

pawn Code:
public  OnGameModeExit( ) {
    new
        vPath[48];
       
    for( new v = 0; v < MAX_OWNED_VEHICLES; v++ ) {
        format( vPath, sizeof( vPath ), VEHICLE_PATH, v);
        if( fexist ( vPath ) ) {
            printf("vPath: %s", vPath);
            new
                mStr[48],
                Float:vPos[4],
                C1,         C2,
                INI:vehFile = INI_Open( vPath );
               
            GetVehiclePos( v, vPos[0], vPos[1], vPos[2] );
            GetVehicleZAngle( v, vPos[3] );
            GetVehicleColor( v, C1, C2 );
               
            INI_SetTag(vehFile, "vehicle");
           
            INI_WriteInt(vehFile, "ModelID",            vehInfo[v][ModelID]);
            INI_WriteInt(vehFile, "PrimaryColour",      C1);
            INI_WriteInt(vehFile, "SecondaryColour",    C2);
           
            INI_WriteInt(vehFile, "Locked",             vehInfo[v][Locked]);
           
            for( new m = 0; m < MAX_VEHICLE_MODS; m++ ) {
                format( mStr, sizeof( mStr ), "Modification%d", m);
                INI_WriteInt(vehFile, mStr,             vehInfo[v][Modification][m]);
            }
           
            INI_WriteString(vehFile, "Owner",           vehInfo[v][Owner]);
            INI_WriteString(vehFile, "LicensePlate",    vehInfo[v][LicensePlate]);

            INI_WriteFloat(vehFile, "XPOS",             vPos[0]);
            printf("vPos[0]: %f", vPos[0]);
            INI_WriteFloat(vehFile, "YPOS",             vPos[1]);
            INI_WriteFloat(vehFile, "ZPOS",             vPos[2]);
            INI_WriteFloat(vehFile, "APOS",             vPos[3]);
               
            INI_Close( vehFile );
        }
    }
    return true;
}
__________________
Check out my wiki page
2KY is offline   Reply With Quote
Old 07/03/2012, 09:03 AM   #2
Shabi RoxX
Gangsta
 
Shabi RoxX's Avatar
 
Join Date: Jan 2012
Location: ____Pakistan______ Playing Since: 5-April-2008 Facebook:Shabi RoxX
Posts: 534
Reputation: 134
Default Re: OnGameModeExit problems.

Same happens to me , it is cuz when server restart it dels all veh , all variable sets to 0, u may create a fuction to save data and then timer for gmx.......

Hope u understand
Shabi RoxX is offline   Reply With Quote
Old 07/03/2012, 09:38 AM   #3
T0pAz
Guest
 
Posts: n/a
Default Re: OnGameModeExit problems.

Never worked on INI before but I think there is something wrong with the max owned vehicles variable.
  Reply With Quote
Old 07/03/2012, 12:45 PM   #4
2KY
Gangsta
 
2KY's Avatar
 
Join Date: Jan 2012
Location: United States
Posts: 950
Reputation: 166
Default Re: OnGameModeExit problems.

Quote:
Originally Posted by Shabi RoxX View Post
Same happens to me , it is cuz when server restart it dels all veh , all variable sets to 0, u may create a fuction to save data and then timer for gmx.......

Hope u understand
I will give a try, thank you.

Quote:
Originally Posted by T0pAz View Post
Never worked on INI before but I think there is something wrong with the max owned vehicles variable.
That's not the problem as MAX_OWNED_VEHICLES is a number (1,000 in this case), and I've debugged it, and the loop DOES get called, it just resets all of my values to zero.
__________________
Check out my wiki page
2KY is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Bug] OnGameModeExit scottyishere Help Archive 2 14/12/2010 12:21 PM
PVars in OnGameModeExit Level147 Bug Reports 17 28/11/2010 11:27 AM
OnGameModeExit GaGlets(R) Help Archive 4 27/11/2010 11:55 PM


All times are GMT. The time now is 09:35 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.