Public Function Problem
#1

Hello.

Quote:

14:12:26] [debug] Run time error 4: "Array index out of bounds"
[14:12:26] [debug] Attempted to read/write array element at index 100 in array of size 100
[14:12:26] [debug] AMX backtrace:
[14:12:26] [debug] #0 00174970 in public OnLoginInit (1, 1) from Compile.amx
[14:12:26] [connection] incoming connection: 127.0.0.1:55755 id: 0
[14:14:04] [debug] Run time error 4: "Array index out of bounds"
[14:14:04] [debug] Attempted to read/write array element at negative index -400
[14:14:04] [debug] AMX backtrace:
[14:14:04] [debug] #0 00143f08 in public OnDealershipVehicleBought (1, 0, 1, 0, 40500) from Compile.amx
[14:14:53] [debug] Run time error 4: "Array index out of bounds"
[14:14:53] [debug] Attempted to read/write array element at negative index -400
[14:14:53] [debug] AMX backtrace:
[14:14:53] [debug] #0 00143f08 in public OnDealershipVehicleBought (1, 0, 1, 0, 60500) from Compile.amx

OnLoginInIt

PHP код:
public OnLoginInit(playeridtype)
{
    if(
PlayerInfo[playerid][pOffReg] == 1) {
        
SetPVarInt(playerid"UCPMode"1);
        
ShowPlayerDialog(playerid,516,DIALOG_STYLE_INPUT,"[UCP] Choose a new email","Enter your new email below","Continue""Cancel");
        new 
query[128];
        
mysql_format(handlesqlquerysizeof(query), "UPDATE accounts SET `OfflineReg`=0 WHERE Name='%s'"PlayerName(playerid));
        
mysql_tquery(handlesqlquery);
    }
    else 
SendClientMessage(playeridCOLOR_YELLOW"Don't forget to use /ucp to view your 'User Control Panel'.");
    
    new 
string[128], query[128];
    switch(
type)
    {
        case 
1:
        {
            if(
GetPVarInt(playerid,"SpawnLocation") == 1)
            {
                new 
count 0;
                if(
GetPVarInt(playerid,"HouseKey") != 0count++;
                if(
GetPVarInt(playerid,"BizzKey") != 0count++;
                if(
GetPVarInt(playerid,"Member") == || GetPVarInt(playerid,"Member") == || GetPVarInt(playerid,"Member") == 8count++;
                if(
count 0)
                {
                    
CallRemoteFunction("SelectSpawnpoint","i"playerid);
                    
TextDrawShowForPlayer(playeridSpawnDraw[4]);
                    
TextDrawShowForPlayer(playeridSpawnDraw[5]);
                    return 
true;
                }
            }
            
TextDrawHideForPlayer(playeridSideBar1);
            
TextDrawHideForPlayer(playeridSideBar2);
            
ClearChatbox(playerid,50);
            
TogglePlayerSpectating(playerid0);
            
SetCameraBehindPlayer(playerid);
            
SpawnPlayer(playerid);
            
SetSpawnInfo(playerid0GetPVarInt(playerid,"Model"), GetPVarFloat(playerid"PosX"),GetPVarFloat(playerid"PosY"),GetPVarFloat(playerid"PosZ"), 0.0000000);
            
SetPlayerSkinEx(playeridGetPVarInt(playerid,"Model"));
            
SetPlayerPosEx(playeridGetPVarFloat(playerid"PosX"), GetPVarFloat(playerid"PosY"), GetPVarFloat(playerid"PosZ"));
            
SetPlayerInterior(playerid,GetPVarInt(playerid"Interior"));
            
SetPlayerVirtualWorld(playerid,GetPVarInt(playerid"World"));
            
TogglePlayerControllable(playeridfalse);
            
SetTimerEx("OnLoginInit"1000false"ii"playerid2);
            
SetPlayerScore(playeridGetPVarInt(playerid"ConnectTime"));
            
SetCameraBehindPlayer(playerid);
            
            
mysql_format(handlesqlstringsizeof(string), "SELECT * FROM `adjust` WHERE `name`='%s'"PlayerInfo[playerid][pUsername]);
            
mysql_tquery(handlesqlstring"LoadHolsterSQL""d"playerid);
            
            for(new 
0301i++)
            {
                
PlayerInfo[playerid][pBlockPM][i] = 0;
            }
            for(new 
06i++)
            {
                
TextDrawHideForPlayer(playeridWoundDraw[i]);
            }
            for(new 
19o++)
            {
                if(
IsPlayerAttachedObjectSlotUsed(playerido))
                {
                    
RemovePlayerAttachedObject(playerido);
                }
            }
            for(new 
04o++)
            {
                
TextDrawHideForPlayer(playeridPGBar[o][playerid]);
            }         
        }
        case 
2:
        {
            
SetPVarInt(playerid"PlayerLogged"1);
            
SetCameraBehindPlayer(playerid);
            
TogglePlayerControllable(playeridtrue);
            
StopAudioStreamForPlayerEx(playerid);
            
SetPlayerColor(playeridCOLOR_WHITE);
            if(
GetPVarFloat(playerid"Health") > 0.0SetPlayerHealth(playerid,GetPVarFloat(playerid"Health"));
            if(
PlayerInfo[playerid][pArmour] > 0.0SetPlayerArmourEx(playerid,PlayerInfo[playerid][pArmour]);
            
//==============================//}
            
PreloadAnimLib(playerid,"CRACK"); PreloadAnimLib(playerid,"CARRY");
            
PreloadAnimLib(playerid,"SWEET"); PreloadAnimLib(playerid,"PED");
            
PreloadAnimLib(playerid,"RAPPING"); PreloadAnimLib(playerid,"COP_AMBIENT");
            
PreloadAnimLib(playerid,"DEALER"); PreloadAnimLib(playerid,"BEACH");
            
PreloadAnimLib(playerid,"ON_LOOKERS"); PreloadAnimLib(playerid,"SUNBATHE");
            
PreloadAnimLib(playerid,"RIOT"); PreloadAnimLib(playerid,"SHOP");
            
PreloadAnimLib(playerid,"PARACHUTE"); PreloadAnimLib(playerid,"GHANDS");
            
PreloadAnimLib(playerid,"MEDIC"); PreloadAnimLib(playerid,"MISC");
            
PreloadAnimLib(playerid,"SWAT"); PreloadAnimLib(playerid,"GANGS");
            
PreloadAnimLib(playerid,"BOMBER"); PreloadAnimLib(playerid,"FOOD");
            
PreloadAnimLib(playerid,"PARK"); PreloadAnimLib(playerid,"GRAVEYARD");
            
PreloadAnimLib(playerid,"KISSING"); PreloadAnimLib(playerid,"KNIFE");
            
PreloadAnimLib(playerid,"FINALE"); PreloadAnimLib(playerid,"SMOKING");
            
PreloadAnimLib(playerid,"BLOWJOBZ"); PreloadAnimLib(playerid,"SNM");
            
PreloadAnimLib(playerid,"LOWRIDER"); PreloadAnimLib(playerid,"DANCING");
            
PreloadAnimLib(playerid,"ROB_BANK"); PreloadAnimLib(playerid,"POLICE");
            
PreloadAnimLib(playerid,"SILENCED");
            
//==============================//
            
SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,GetPVarInt(playerid"9mmSkill"));
            
SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_SHOTGUN,GetPVarInt(playerid"sawnoffSkill"));
            
SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,GetPVarInt(playerid"uziSkill"));
            
//==============================//
            
CallRemoteFunction("OnPlayerDataSave""i"playerid);
            
//==============================//}
            
TextDrawShowForPlayer(playerid,MoneyDraw2);
            
TextDrawShowForPlayer(playerid,ServerDraw);
            
//==============================//
            
MoneyDraw[playerid] = TextDrawCreate(497.000000,77.000000,"~g~$00000000");
            
TextDrawAlignment(MoneyDraw[playerid],0);
            
TextDrawBackgroundColor(MoneyDraw[playerid],0x000000ff);
            
TextDrawFont(MoneyDraw[playerid],3);
            
TextDrawLetterSize(MoneyDraw[playerid],0.599999,2.200000);
            
TextDrawColor(MoneyDraw[playerid],0xffffffff);
            
TextDrawSetOutline(MoneyDraw[playerid],1);
            
TextDrawSetProportional(MoneyDraw[playerid],1);
            
TextDrawSetShadow(MoneyDraw[playerid],1);
            
TextDrawShowForPlayer(playerid,MoneyDraw[playerid]);
            
LocationDraw[playerid] = TextDrawCreate(38.000000329.000000" ");
            
TextDrawBackgroundColor(LocationDraw[playerid], 255);
            
TextDrawFont(LocationDraw[playerid], 2);
            
TextDrawLetterSize(LocationDraw[playerid], 0.2800001.000000);
            
TextDrawColor(LocationDraw[playerid], -1);
            
TextDrawSetOutline(LocationDraw[playerid], 0);
            
TextDrawSetProportional(LocationDraw[playerid], 1);
            
TextDrawSetShadow(LocationDraw[playerid], 1);
            
format(stringsizeof(string),"~w~%s"GetPlayerArea(playerid));
            
TextDrawSetString(Text:LocationDraw[playerid], string);
            
TextDrawShowForPlayer(playeridLocationDraw[playerid]);
            
//==============================//
            
CallRemoteFunction("PrintHud","i",playerid);
            
//==============================//
            
format(querysizeof(query), "UPDATE `accounts` SET `Online` = 1 WHERE `Name`='%s'"PlayerName(playerid));
            
mysql_tquery(handlesqlquery);
            
//==============================//
            
LoadChecks(playerid);
            
//==============================//
            
format(stringsizeof(string), "SELECT * FROM `toys` WHERE `PlayerName`='%s'"PlayerName(playerid));
            
mysql_function_query(handlesqlstringtrue"LoadToys""d"playerid);
            if(
PlayerInfo[playerid][pPlayerWeapon] > && PlayerInfo[playerid][pPlayerAmmo] > 0)
            {
                
GivePlayerWeaponEx(playeridPlayerInfo[playerid][pPlayerWeapon], PlayerInfo[playerid][pPlayerAmmo]);
            }
            
//==============================//
            
new mem GetPVarInt(playerid"Member");
            if(
FactionInfo[mem][fUsed] == 1)
            {
                
format(stringsizeof(string),"FACTION-MOTD: %s"FactionInfo[mem][fMOTD]);
                
SCM(playerid0xE65A5AAAstring);
            }
            else { 
SetPVarInt(playerid"Member"0), SetPVarInt(playerid"Rank"0); }
            
//==============================//
            
SCM(playeridCOLOR_LIGHTRED"To follow up on updates visit our website @ www.diverseroleplay.org");
            
SCM(playeridCOLOR_LIGHTRED"IMPORTANT: Please make sure your account is always linked to a valid email address. (/ucp -> Player Options)");
            
SCM(playeridCOLOR_LIGHTRED"*Email addresses are kept private, and are only used for password-recovery purposes.*");
            
//==============================//
            
if(strcmp(PlayerInfo[playerid][pDescribe], " "true) == 0strmid(PlayerInfo[playerid][pDescribe], "None"0strlen("None"), 255);
            if(
strcmp(PlayerInfo[playerid][pDescribe2], " "true) == 0strmid(PlayerInfo[playerid][pDescribe2], "None"0strlen("None"), 255);
            
//==============================//
            
switch(GetPVarInt(playerid"FightStyle"))
            {
                case 
0SetPlayerFightingStyle(playerid,FIGHT_STYLE_NORMAL);
                case 
1SetPlayerFightingStyle(playerid,FIGHT_STYLE_BOXING);
                case 
2SetPlayerFightingStyle(playerid,FIGHT_STYLE_KUNGFU);
                case 
3SetPlayerFightingStyle(playerid,FIGHT_STYLE_KNEEHEAD);
                case 
4SetPlayerFightingStyle(playerid,FIGHT_STYLE_GRABKICK);
                case 
5SetPlayerFightingStyle(playerid,FIGHT_STYLE_ELBOW);
            }
            
//==============================//
            
if(GetPVarInt(playerid"Dead") == || GetPVarInt(playerid"Dead") == 2)
            {
                
TogglePlayerControllable(playerid,false);
                
SetPVarInt(playerid"Dead"2);
                
SetPlayerPosEx(playerid,GetPVarFloat(playerid"PosX"),GetPVarFloat(playerid"PosY"),GetPVarFloat(playerid"PosZ"));
                
SetPlayerFacingAngle(playerid,GetPVarFloat(playerid"Angle"));
                
SetPlayerInterior(playerid,GetPVarInt(playerid"Interior"));
                
SetPlayerVirtualWorld(playerid,GetPVarInt(playerid"World"));
                
SetCameraBehindPlayer(playerid);
                
SendClientMessage(playerid,COLOR_WHITE,"Type (/accept death) to continue.");
                
SetPlayerHealth(playerid,1.0);
                new 
rand random(5)+1;
                switch(
rand)
                {
                    case 
1ApplyAnimation(playerid"ped""FLOOR_hit"4.00111, -1);
                    case 
2ApplyAnimation(playerid"ped""FLOOR_hit_f"4.00111, -1);
                    case 
3ApplyAnimation(playerid"ped""KO_shot_front"4.00111, -1);
                    case 
4ApplyAnimation(playerid"ped""KO_shot_stom"4.00111, -1);
                    case 
5ApplyAnimation(playerid"ped""BIKE_fall_off"4.00111, -1);
                    default: 
ApplyAnimation(playerid"FINALE""FIN_Land_Die"4.00111, -1);
                }
                if(
GetPVarInt(playerid"Admin") != 10SetPVarInt(playerid"DeathTime"GetCount()+60000);
                return 
1;
            }
            if(
GetPVarInt(playerid"Dead") == 3)
            {
                
DeathPlayer(playerid"You need to rest to regain consciousness.");
                return 
true;
            }
            
//==============================//
            
if(GetPVarInt(playerid"Backpack") == 1SetPlayerAttachedObject(playerid637110.0, -0.140.00.090359.5022111);
            
//==============================//
            
switch(GetPVarInt(playerid"Jailed"))
            {
                case 
1:
                {
                    
SetPlayerPosEx(playerid, -1406.7714,1245.1904,1029.8984);
                    
SetPlayerFacingAngle(playerid177.0008);
                    
SetPlayerInterior(playerid16);
                    
SetPlayerVirtualWorld(playeridplayerid 1);
                    
format(stringsizeof(string),"[JAILED] You are in admin-jail for %d seconds."GetPVarInt(playerid"Jailtime"));
                    
SCM(playerid0xE65A5AAAstring);
                    
SetPVarInt(playerid"Mute"1);
                }
                case 
2:
                {
                    new 
ran random(3) + 1;
                    if(
ran == 1SetPlayerPosEx(playerid2592.0681,-1506.9999,-48.9141);
                    else if(
ran == 2SetPlayerPosEx(playerid2588.0879,-1526.0541,-48.9141);
                    else 
SetPlayerPosEx(playerid2583.7458,-1526.5377,-48.9141);
                    
SetPlayerInterior(playerid1);
                    
SetPlayerVirtualWorld(playerid1);
                    
SCM(playerid0xE65A5AAA"[JAILED] You are in jail.");
                }
            }
            
//==============================//
            
if(IsPlayerInRangeOfPoint(playerid15.02233.0278,2457.1990,-7.4531+10.0)) // UNBUG DEALERSHIP SYSTEM
            
{
                
SetPlayerPosEx(playerid1529.6,-1691.2,13.3);
                
SetPlayerInterior(playerid,0);
                
SetPlayerVirtualWorld(playerid,0);
                
SendClientMessage(playerid0xFF000000"You have been sent to Los Santos!.");
            }
            
//==============================//
            
LoadRadios(playerid);
            
CallRemoteFunction("LoadHolsters","i",playerid);
            
/*if(GetPVarInt(playerid, "HouseKey") != 0)
            {
                if(strcmp(HouseInfo[GetPVarInt(playerid, "HouseKey")][hOwner], PlayerName(playerid), true) == 0)
                {
                    LoadCars(playerid);
                }
            }*/
            
if(GetPVarInt(playerid"MonthDon") != 0)
            {
                if(
GetPVarInt(playerid"MonthDonT") <= 0)
                {
                    
SetPVarInt(playerid"MonthDon"0);
                    
SetPVarInt(playerid"MonthDonT"0);
                    
scm(playerid, -1"Your monthly subscription has expired!");
                }
            }
            if(
GetPVarInt(playerid"HouseEnter") != 0)
            {
                
HouseLights(GetPVarInt(playerid"HouseEnter"));
            }
            if(
GetPlayerVirtualWorld(playerid) == && GetPlayerInterior(playerid) == && GetPVarInt(playerid"DrugTime") == 0) {
                
SetPlayerTime(playeridGMHourGMMin);
                
SetPlayerWeather(playeridGMWeather);
            }
            
//==============================//
        
}
    }
    return 
1;

OnDealershipvehiclebough

PHP код:
forward OnDealershipVehicleBought(playeridcarmdlid3colprice);
public 
OnDealershipVehicleBought(playeridcarmdlid3colprice) {
    if(
cache_get_row_count() < MaxVehicles(playerid)) {
         new 
query[516], plate[VEHICLE_PLATE_MAX_LENGTH], rand 1000 random(99999999);
          
format(plateVEHICLE_PLATE_MAX_LENGTH"%d"rand);
        
mysql_format(handlesqlquerysizeof(query),"INSERT INTO `vehicles`(`Model`, `X`, `Y`, `Z`, `Angle`, `ColorOne`, `ColorTwo`, `Owner`, `Value`, `Fuel`, `Plate`,`Health`) \
                                                      VALUES (%d, %f, %f, %f, %f, %d, %d, '%e', %d, %d, '%e', %f)"
carmdlDealerships[id3][3], Dealerships[id3][4],
                                                      
Dealerships[id3][5], Dealerships[id3][6], colcolPlayerInfo[playerid][pUsername], price100plate1000.0);
        
mysql_tquery(handlesqlquery);
        if(
GetPVarInt(playerid"CTU") == 1) {
            
SetPVarInt(playerid"CarTicket"GetPVarInt(playerid"CarTicket")-1);
            
DeletePVar(playerid"CTU");
            
SendClientMessage(playeridCOLOR_WHITE"Carticket used !");
        }
        
        if(
GetPVarInt(playerid"CTU") == 2) {
            
SetPVarInt(playerid"CarTicket"GetPVarInt(playerid"CarTicket")-1);
            
DeletePVar(playerid"CTU");
            
format(querysizeof(query), "Carticket used, paid the remainder of $%d!"price);
            
SendClientMessage(playeridCOLOR_WHITEquery);
            
GivePlayerMoneyEx(playerid, -price);
        } else {
            
format(querysizeof(query), "%s purchased for $%d !"VehicleName[carmdl-400], price);
            
SendClientMessage(playeridCOLOR_WHITEquery);
            
GivePlayerMoneyEx(playerid, -price);
            new 
car CreateVehicle(carmdlDealerships[id3][3], Dealerships[id3][4], Dealerships[id3][5], Dealerships[id3][6], colcol1);
            
SetVehicleVirtualWorld(car0);
            
LinkVehicleToInterior(car6);
        }
        
        
OnPlayerDataSave(playerid);
        
VJB=1;
    } else {
        
SendClientMessage(playeridCOLOR_GREY"You cannot buy another vehicle as you've reached the maximum amount of vehicles per-player.");
    }

Reply
#2

Bump
Reply
#3

Could you compile it with -d3? We need the line.

Quote:

Create a pawn.cfg file inside your Pawno directory with just "-d3" inside and recompile.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)