Array / listitem not working
#1

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.

PHP код:
new Prisoners[MAX_PLAYERS];
CustomPickupsOnGameModeInit() {
    
paybail CreateDynamicPickup(131416, -1444.4275,2083.1318,1000.0859,20,20);
CustomPickupsOnPlayerPickupPickup(playeridpickup) {
    if(
pickup == paybail) {
        
bailPlayer(playerid);
        
movePlayerBack(playerid1.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(msg128"Prisoner: %s - Bail Price: $%d\n",GetPlayerNameEx(iENameType_RPName_NoMask), GetPVarInt(i"Bail"));
                
strcat(dialogstrmsgsizeof(dialogstr));
                
Prisoners[i]++;
            }
            
ShowPlayerDialog(playeridEFactionsDialog_PayingBailDIALOG_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(playeridX11_TOMATO_2"You do not have enough money for bail!");
                    return 
1;
                }
                
GiveMoneyEx(playerid, -bailcost);                
                
format(paidbailsizeof(paidbail),"You have bailed %s out of jail bail, cost: $%d",GetPlayerNameEx(Prisoners[listitem], ENameType_RPName_NoMask), GetPVarInt(Prisoners[listitem], "Bail"));
                
format(bailreceivedsizeof(bailreceived),"Your bail has been paid  by %s, bail cost: $%d",GetPlayerNameEx(playeridENameType_RPName_NoMask), GetPVarInt(Prisoners[listitem], "Bail"));
                
SendClientMessage(playeridCOLOR_GREENpaidbail);
                
SendClientMessage(Prisoners[listitem], COLOR_GREENbailreceived);
                
bailfromjail(Prisoners[listitem]);                
                return 
1;
            }
        }
bailfromjail(listitem) {    
    
releaseFromJail(Prisoners[listitem]);                    
    
DeletePVar(Prisoners[listitem], "ReleaseTime");
    return 
1;

Can anyone show me where I've gone wrong.. I seriously can't figure this out an it's annoying please help
Reply


Messages In This Thread
Array / listitem not working - by Prokill911 - 17.02.2015, 21:40
Re: Array / listitem not working - by Jefff - 17.02.2015, 22:20
AW: Array / listitem not working - by Nero_3D - 17.02.2015, 22:35
Re: Array / listitem not working - by Prokill911 - 17.02.2015, 23:48

Forum Jump:


Users browsing this thread: 1 Guest(s)