Weapon system
#1

Heey guys,

I am trying to make a non-spawnweapon system.

What I mean is that when you have 100 ammo for a 9mm and you shoot 2 bullets that when you relog that your ammo is 98 left.

So I need to make that when you relog or when I want that the player saves it he needs to pick up what ammo you need.

Now I found the GetPlayerWeaponData, but how do you save that?

pawn Код:
new weapons[13];
new ammo[13];
for (new i = 0; i < 13; i++)
{
    GetPlayerWeaponData(playerid, i, weapons[i], ammo[i]);
}
This is what I have and how do you save it ?

I use dini.
Reply
#2

Something like:

pawn Код:
dini_IntSet(File, "WEAPON", PlayerInfo[playerid][WEAPON] = GetPlayerWeapon(playerid));
Reply
#3

Quote:
Originally Posted by Stigg
Посмотреть сообщение
Something like:

pawn Код:
dini_IntSet(File, "WEAPON", PlayerInfo[playerid][WEAPON] = GetPlayerWeapon(playerid));
But when a player has more guns then this doesn't work right?
Reply
#4

Quote:
Originally Posted by Stigg
Посмотреть сообщение
Something like:

pawn Код:
dini_IntSet(File, "WEAPON", PlayerInfo[playerid][WEAPON] = GetPlayerWeapon(playerid));
I have found the saving shit now.

Now I have:

pawn Код:
new weapons[13][2], Str[30];
for(new i = 0; i < 13; i++)
{
    GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
    format( Str, 30, "Weapon%d", i );
    dini_IntSet(udb_encode(playername), Str, weapons[i][0]);
    format( Str, 30, "Ammo%d", i );
    dini_IntSet(udb_encode(playername), Str, weapons[i][1]);
}
But when a player is comming in the server,
The scriptfile is now looking like weapon0 = ... weapon 1 = ....
You need to do with everyting like GivePlayerWeapon(playerid, weapon0);
Or is there an easier way?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)