SA-MP Forums Archive
Weapon system (Y_INI) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Weapon system (Y_INI) (/showthread.php?tid=643542)



Weapon system (Y_INI) ( STILL NEED HELP ) - maksicnm - 22.10.2017

I make code in enum pInfo
Код HTML:
        ....        
        oSlot1,
	oSlot2,
	oSlot3,
	oSlot4,
	oSlot5,
	oSlot6,
	oSlot7,
	oSlot8,
	oSlot9,
	oSlot10,
	oSlot11,
	oSlot12,
	oSlot13,
             ...
And i make in register to Ini_WriteINT
Код HTML:
                                        INI_WriteInt(File,"oSlot1",-1);
					INI_WriteInt(File,"oSlot2",-1);
					INI_WriteInt(File,"oSlot3",-1);
					INI_WriteInt(File,"oSlot4",-1);
					INI_WriteInt(File,"oSlot5",-1);
					INI_WriteInt(File,"oSlot6",-1);
					INI_WriteInt(File,"oSlot7",-1);
					INI_WriteInt(File,"oSlot8",-1);
					INI_WriteInt(File,"oSlot9",-1);
					INI_WriteInt(File,"oSlot10",-1);
					INI_WriteInt(File,"oSlot11",-1);
					INI_WriteInt(File,"oSlot12",-1);
					INI_WriteInt(File,"oSlot13",-1);
But, how to make to Ini_WriteInt(File,"oslot", blabla to save weapons?
and to make onplayerconnect to give them weapon from .INI


Re: Weapon system (Y_INI) - maksicnm - 22.10.2017

Sry for DP, i mean on playerdiscconect to get all player weapon's and save them to player.ini file


Re: Weapon system (Y_INI) - McBan - 22.10.2017

Generally speaking, giving players their weapons when they connect is probably a bad idea. Instead, give the weapons to them after spawn. So instead of OnPlayerConnect, try OnPlayerSpawn.

To get the weapon data before they disconnect, read this.

To store the weapon data:
Код:
INI_WriteInt(File,"oSlot1",PlayerInfo[playerid][pWeapon0]);
INI_WriteInt(File,"Ammo0",PlayerInfo[playerid][pAmmo0]);
// Remember to change the variable names to whatever your variable names are.
To give them their weapon when they return, ensure you read the INI file before setting their weapon:
Код:
GivePlayerWeapon(playerid,PlayerInfo[playerid][pWeapon0],PlayerInfo[playerid][pAmmo0]);



Re: Weapon system (Y_INI) - maksicnm - 22.10.2017

McBan, i mean that, i just wrong type it
I'll probably make /inv cmd


Re: Weapon system (Y_INI) - kAn3 - 22.10.2017

Quote:
Originally Posted by McBan
Посмотреть сообщение
Generally speaking, giving players their weapons when they connect is probably a bad idea. Instead, give the weapons to them after spawn. So instead of OnPlayerConnect, try OnPlayerSpawn.

To get the weapon data before they disconnect, read this.

To store the weapon data:
Код:
INI_WriteInt(File,"oSlot1",PlayerInfo[playerid][pWeapon0]);
INI_WriteInt(File,"Ammo0",PlayerInfo[playerid][pAmmo0]);
// Remember to change the variable names to whatever your variable names are.
To give them their weapon when they return, ensure you read the INI file before setting their weapon:
Код:
GivePlayerWeapon(playerid,PlayerInfo[playerid][pWeapon0],PlayerInfo[playerid][pAmmo0]);
Better to use onplayerconnect to load the variables, and use giveplayerweapon when he spawns.