Store weapons of player
#1

I'm creating minigames, and I created my own 'include' file where there are many functions and the two i'll be talking about is savePlayerInfo(playerid) and setPlayerInfo(playerid).

What I'm doing is before the player goes to the minigame, their weapons and location will be saved using the savePlayerInfo(playerid) function and when they exit it their location and weapon will be set to the ones determined by savePlayerInfo using setPlayerInfo. Everything works correctly, the location i mean.

But the problem is that my weapons are not correct. I use this function to store weapons:

At the header:
Код:
new weaponInReal[13][2];
Saving weapons in savePlayerInfo(playerid):

Код:
savePlayerSpawnWeaponInfo(playerid){
	for (new i = 0; i < 13; i++)
	{
             GetPlayerWeaponData(playerid, i, weaponInReal[i][0], weaponInReal[i][1]);
	}
}

I know this only saves weapon info for only the latest player who called this function. But if I make the code like this which will save everyone's weapon data:

At the header:
Код:
new weaponInReal[MAX_PLAYERS][13][2];
Saving weapons in savePlayerInfo(playerid):

Код:
savePlayerSpawnWeaponInfo(playerid){
	for (new i = 0; i < 13; i++)
	{
             GetPlayerWeaponData(playerid, i, weaponInRea[playerid]l[i][0], weaponInReal[playerid][i][1]);
	}
}
If I do like that, the server crashes. What can I do?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)