06.05.2011, 15:26
I have a weapon-saving system:
OnPlayerConnect: (I've created the PlayerWeapons.)
OnPlayerSpawn:
And OnPlayerDisconnect:
And if you want to see, the dialog-setting:
So, when I connect, I get that dialog, choose what I want, OK. When I kill myself, it's working, I get those weaps again.
The problem is: When I reconnect, I get the dialog again.
Why is that happening?
OnPlayerConnect: (I've created the PlayerWeapons.)
pawn Код:
for(new i = 0; i < 4; i++) {
new which[20];
format(which,sizeof(which),"SW%i",i);
if(GetPVarInt(playerid,which) == 0) {
PlayerWeapons[playerid][i] = -1;
} else {
PlayerWeapons[playerid][i] = GetPVarInt(playerid,which);
}
}
pawn Код:
new WeapsEmpty;
for(new i = 1; i < 4; i++) {
if(PlayerWeapons[playerid][i] != -1) {
GivePlayerWeapon(playerid,PlayerWeapons[playerid][i],90);
} else {
WeapsEmpty++;
}
}
if(WeapsEmpty == 3) {
format(dia,sizeof(dia),"Desert Eagle {36FF00} $50[much more here..]");
ShowPlayerDialog(playerid,32,DIALOG_STYLE_LIST,"Starter Weapons",dia,"OK","Cancel");
} else {
PayMoney(playerid,PlayerWeapons[playerid][0]);
}
pawn Код:
SetPVarInt(playerid,"SW0",PlayerWeapons[playerid][0]);
SetPVarInt(playerid,"SW1",PlayerWeapons[playerid][1]);
SetPVarInt(playerid,"SW2",PlayerWeapons[playerid][2]);
SetPVarInt(playerid,"SW3",PlayerWeapons[playerid][3]);
pawn Код:
PlayerWeapons[playerid][1] = 24;
PlayerWeapons[playerid][2] = 31;
PlayerWeapons[playerid][0] = 100;
The problem is: When I reconnect, I get the dialog again.
Why is that happening?