Weapon system (Y_INI)
#1

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
Reply
#2

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

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]);
Reply
#4

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

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)