Question about saving player inventory before duty and gethim back when off duty -
5002 - 20.01.2019
hello to you
its about my plan for duty system in rp server use r41+zcmd+sscanf2+foreach
ok,its my plan:
player enter cmd what named duty at special position in console, then a dialog menu be open with items
1.select cloths
^^^^^items^^^^
1.lspd
2.lvpd
3.sfpd
wich item giveplayer new skin and patrol equipments.
2.go off duty
take player to last situation he was
now i think can create dialog structure and havent prob on it,but about save player situation!
like weapons,armour and skin he have before join duty
and take them back to him when he off duty i dont know what i must do..

please say your views and helpsģ
Re: Question about saving player inventory before duty and gethim back when off duty -
5002 - 20.01.2019
Quote:
Originally Posted by Y_Less
Make a variable. Put the data in said variable. Read data from the variable.
|
//////
enum PDATA
{
pPolice,
pskin,
pweapon,
pammo,
pcolor,
parmour
}
new pinfo[MAX_PLAYER][PDATA];
public OnPlayerDisconnect(playerid, reason)
{
if(pinfo[playerid][pPolice] = 1 || pinfo[playerid][pPolice] > 1)
{
new pweapon = GetPlayerWeapon(playerid);//weapon
new pammo = GetPlayerAmmo(playerid);//ammo
new pskin = GetPlayerSkin(playerid);//skin
new pcolor = GetPlayerColor(playerid);//color
new parmour = GetPlayerArmour(playerid
new policelevel = pinfo[playerid][pPolice] ;
mysql_format(policemod,128,"UPDATE 'Players' SET 'pPolice' = %i, 'pskin' = %i , 'pweapon' = %i , 'pammo' = %i , 'pcolor' = %i , 'parmour' = %i WHERE 'USERNAME' = %s" ,policelevel, pskin,pweapon,pammo,pcolor,parmour,pinfo[playerid][pname]);
mysql_query(policemod);
return 1;
}
}
now data save if player dc
and i must rtry this when he use cmd to save then load when he go off?
and if player dc when are in duty
table updated and last stats lost!and police stats will save at table
and .... im confuse😥😅
Re: Question about saving player inventory before duty and gethim back when off duty -
ApolloScripter - 20.01.2019
Quote:
Originally Posted by 5002
//////
enum PDATA
{
pPolice,
pskin,
pweapon,
pammo,
pcolor,
parmour
}
new pinfo[MAX_PLAYER][PDATA];
public OnPlayerDisconnect(playerid, reason)
{
if(pinfo[playerid][pPolice] = 1 || pinfo[playerid][pPolice] > 1)
{
new pweapon = GetPlayerWeapon(playerid);//weapon
new pammo = GetPlayerAmmo(playerid);//ammo
new pskin = GetPlayerSkin(playerid);//skin
new pcolor = GetPlayerColor(playerid);//color
new parmour = GetPlayerArmour(playerid
new policelevel = pinfo[playerid][pPolice] ;
mysql_format(policemod,128,"UPDATE 'Players' SET 'pPolice' = %i, 'pskin' = %i , 'pweapon' = %i , 'pammo' = %i , 'pcolor' = %i , 'parmour' = %i WHERE 'USERNAME' = %s" ,policelevel, pskin,pweapon,pammo,pcolor,parmour,pinfo[playerid][pname]);
mysql_query(policemod);
return 1;
}
}
now data save if player dc
and i must rtry this when he use cmd to save then load when he go off?
and if player dc when are in duty
table updated and last stats lost!and police stats will save at table
and .... im confuse😥😅
|
Hello, to save the values, use some .INI writer and reader, such as DOF2, or YINI, so you can save the values of the player's variables when they disconnect, then you can apply the values back to the variables when they log in.
Re: Question about saving player inventory before duty and gethim back when off duty -
5002 - 20.01.2019
Quote:
Originally Posted by ApolloScripter
Hello, to save the values, use some .INI writer and reader, such as DOF2, or YINI, so you can save the values of the player's variables when they disconnect, then you can apply the values back to the variables when they log in.
|
i have reg system with mysql r41
now you tell use yini or dof2?
they are better than mysql?
plz answer it
after i see a few example,i create what i need.
i have a few question
i create dialogs right and the cmd compelated.
but for save states i must use insert or update ?on mysql_format??
i need your examples and helps🍒