17.02.2015, 21:40
hello, so earlier I made a thread about listitems someone said to array it, so I did...
Here's my code..
But It still returns listitem value 0 eaech time.
so if I had 30 people in the server, an 10 of them are jailed, If ID 10 is jailed, an you try an unjail him, It will just unjail id 0 each time, Never unjailing anything above ID 0.
Can anyone show me where I've gone wrong.. I seriously can't figure this out an it's annoying please help
Here's my code..
But It still returns listitem value 0 eaech time.
so if I had 30 people in the server, an 10 of them are jailed, If ID 10 is jailed, an you try an unjail him, It will just unjail id 0 each time, Never unjailing anything above ID 0.
PHP код:
new Prisoners[MAX_PLAYERS];
CustomPickupsOnGameModeInit() {
paybail = CreateDynamicPickup(1314, 16, -1444.4275,2083.1318,1000.0859,20,20);
CustomPickupsOnPlayerPickupPickup(playerid, pickup) {
if(pickup == paybail) {
bailPlayer(playerid);
movePlayerBack(playerid, 1.5);
}
}
bailPlayer(playerid) {
new msg[128];
dialogstr[0] = 0;
for(new i=0;i<MAX_PLAYERS;i++) {
if(IsPlayerConnectEx(i)) {
new jailtime = GetPVarInt(i, "ReleaseTime");
jailtime -= gettime();
if(jailtime > 0) {
format(msg, 128, "Prisoner: %s - Bail Price: $%d\n",GetPlayerNameEx(i, ENameType_RPName_NoMask), GetPVarInt(i, "Bail"));
strcat(dialogstr, msg, sizeof(dialogstr));
Prisoners[i]++;
}
ShowPlayerDialog(playerid, EFactionsDialog_PayingBail, DIALOG_STYLE_LIST, "List of prisoners.", dialogstr, "Pay Bail", "Cancel");
}
}
return 1;
}
case EFactionsDialog_PayingBail: {
if(response) {
new paidbail[256];
new bailreceived[256];
new bailcost = GetPVarInt(Prisoners[listitem], "Bail");
new money = GetPVarInt(playerid, "Money");
if(money < bailcost) {
SendClientMessage(playerid, X11_TOMATO_2, "You do not have enough money for bail!");
return 1;
}
GiveMoneyEx(playerid, -bailcost);
format(paidbail, sizeof(paidbail),"You have bailed %s out of jail bail, cost: $%d",GetPlayerNameEx(Prisoners[listitem], ENameType_RPName_NoMask), GetPVarInt(Prisoners[listitem], "Bail"));
format(bailreceived, sizeof(bailreceived),"Your bail has been paid by %s, bail cost: $%d",GetPlayerNameEx(playerid, ENameType_RPName_NoMask), GetPVarInt(Prisoners[listitem], "Bail"));
SendClientMessage(playerid, COLOR_GREEN, paidbail);
SendClientMessage(Prisoners[listitem], COLOR_GREEN, bailreceived);
bailfromjail(Prisoners[listitem]);
return 1;
}
}
bailfromjail(listitem) {
releaseFromJail(Prisoners[listitem]);
DeletePVar(Prisoners[listitem], "ReleaseTime");
return 1;
}