Save information
#6

Quote:
Originally Posted by Banana_Ghost
Посмотреть сообщение
Something like this maybe.....
PHP код:
new //Creating Variables to store the information for all player slots.
    
Float:Health[MAX_PLAYERS],//This is the float you'll save the player's health in.
    
Float:Armor[MAX_PLAYERS],//This is the float you'll save the player's armor in.
    
Float:playerpos[MAX_PLAYERS][4],//This is the float you'll save the player's position and facing angle in.
    
interior[MAX_PLAYERS],//This is where you'll save the player's current interior.
    
virtualworld[MAX_PLAYERS],//This is where you'll save the player's current virtual world.
    
weapondata[MAX_PLAYERS][13][2];//This is the array you'll save the player's weapon data in.
    
    
//Do whatever here to save their stuff, for example
YCMD:savedata(playerid,params[],help)
{
    
#pragma unused params, help
    
GetPlayerHealth(playeridHealth[playerid]);//You are storing the player's health into the float above.
    
GetPlayerArmour(playeridArmor[playerid]);//You are storing the player's armor into the float above.
    
GetPlayerPos(playerid,playerpos[playerid][0],playerpos[playerid][1],playerpos[playerid][2]);//You are storing the player's position into the float above.
    
GetPlayerFacingAngle(playerid,playerpos[playerid][3]);//You are storing the player's facing angle into the float above.
    
interior[playerid] = GetPlayerInterior(playerid);//You are storing the interior above.
    
virtualworld[playerid] = GetPlayerVirtualWorld(playerid);//You are storing the player's virtual world.
    
for (new 0<= 12i++)//Looping through each weapon slot (13 slots) (Looping 0 -12)
    
{
        
GetPlayerWeaponData(playeridiweapondata[playerid][i][0], weapondata[playerid][i][1]);
        
//Every time the above loops, the slot number increases, as doing so, it's storing your weapon data into the array above.
    
}
    return 
1;
}
//Do whatever here to give their stuff back
YCMD:givedata(playerid,params[],help)
{
    
#pragma unused params, help
    
SetPlayerHealth(playeridHealth[playerid]);//You are setting the player's health back to what it was before the condition above.
    
SetPlayerArmour(playeridArmor[playerid]);//You are setting the player's armor back to what it was before the condition above.
    
SetPlayerPos(playerid,playerpos[playerid][0],playerpos[playerid][1],playerpos[playerid][2]);//You are setting the player's position back to what it was before the condition above.
    
SetPlayerFacingAngle(playerid,playerpos[playerid][3]);//You are setting the player's facing angle to what it was before the condition above.
    
SetPlayerInterior(playerid,interior[playerid]);//You are setting the player's interior to what it was before the condition above.
    
SetPlayerVirtualWorld(playerid,virtualworld[playerid]);//You are setting the player's virtual world to what it was before the condition above.
    
for (new 0<= 12i++)
    {
        
GivePlayerWeapon(playerid,weapondata[playerid][i][0], weapondata[playerid][i][1]);
        
//Here, you are looping through the array we saved the player's weapon data in.  This is giving the player their weapons they had before.
    
}
    return 
1;

Thank you very much
Reply


Messages In This Thread
Save information - by Tess - 25.05.2015, 13:40
Re: Save information - by MikE1990 - 25.05.2015, 14:07
Re: Save information - by Tess - 25.05.2015, 16:13
Re: Save information - by Tess - 26.05.2015, 11:21
Re: Save information - by Banana_Ghost - 26.05.2015, 11:21
Re: Save information - by Tess - 26.05.2015, 11:24
Re: Save information - by Tess - 27.05.2015, 07:55
Re: Save information - by Banana_Ghost - 27.05.2015, 12:42
Re: Save information - by Tess - 27.05.2015, 13:27
Re: Save information - by Tess - 27.05.2015, 16:12

Forum Jump:


Users browsing this thread: 1 Guest(s)