15.05.2014, 21:42
Player kills player, gives first player a score. Did that.
Writes to a file, did that. loads score when player connects.
only when you hit spawn after selecting class does it reset the score. Dont want that, want it to give back saved score. But it saves and loads my money just fine.
Code from gamemode:
Code from accounts FS:
Writes to a file, did that. loads score when player connects.
only when you hit spawn after selecting class does it reset the score. Dont want that, want it to give back saved score. But it saves and loads my money just fine.
Code from gamemode:
Код:
public OnPlayerSpawn(playerid) { if(GetPVarInt(playerid, "Dead")) { SetPlayerPos(playerid, 2027.6873,-1420.3046,16.9922); // Position of the hospital. DeletePVar(playerid, "Dead"); } return 1; }
Код:
CMD:login( playerid, params[ ] ) { new file[ 256 ], Passw[ 500 ]; format( file, sizeof file, DIRECTORY, pName( playerid ) ); INI_ParseFile(file, "Pass", false, true, playerid); GetPVarString( playerid, "pPass", Passw, sizeof Passw ); if( GetPVarInt( playerid, "pLog" ) == 1 ) return SystemMsg( playerid, "You have already logged-in." ); if( !INI_Exist ( pName( playerid ) ) ) return SystemMsg( playerid, "This name is not registered. /register password for free $150,000!" ); if( isnull ( params ) ) return SystemMsg( playerid, "Usage: /login [password]" ); if( strcmp ( Passw, params, false ) == 0 ) { SetPlayerScore( playerid, GetPVarInt( playerid, "pScore" ) ); GivePlayerMoney( playerid, GetPVarInt( playerid, "pCash" ) ); SetPVarInt( playerid, "pLog", 1 ); SystemMsg( playerid, "You have successfully logged-in." ); }else SystemMsg( playerid, "Wrong Credentials!" ); return ( 1 ); } public Pass( playerid, name[ ], value[ ] ) { if( !strcmp ( name, "Password" ) ) { SetPVarString( playerid, "pPass", value ); } } public LoadpUser( playerid, name[ ], value[ ] ) { if( !strcmp ( name, "Money" ) ) { SetPVarInt( playerid, "pCash", strval( value ) ); } if( !strcmp ( name, "Score" ) ) { SetPVarInt( playerid, "pScore", strval( value ) ); } }