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(playerid, Health[playerid]);//You are storing the player's health into the float above.
GetPlayerArmour(playerid, Armor[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 i = 0; i <= 12; i++)//Looping through each weapon slot (13 slots) (Looping 0 -12)
{
GetPlayerWeaponData(playerid, i, weapondata[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(playerid, Health[playerid]);//You are setting the player's health back to what it was before the condition above.
SetPlayerArmour(playerid, Armor[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 i = 0; i <= 12; i++)
{
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;
}