12.09.2017, 12:45
Hello.
OnLoginInIt
OnDealershipvehiclebough
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 |
PHP код:
public OnLoginInit(playerid, type)
{
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(handlesql, query, sizeof(query), "UPDATE accounts SET `OfflineReg`=0 WHERE Name='%s'", PlayerName(playerid));
mysql_tquery(handlesql, query);
}
else SendClientMessage(playerid, COLOR_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") != 0) count++;
if(GetPVarInt(playerid,"BizzKey") != 0) count++;
if(GetPVarInt(playerid,"Member") == 1 || GetPVarInt(playerid,"Member") == 2 || GetPVarInt(playerid,"Member") == 8) count++;
if(count > 0)
{
CallRemoteFunction("SelectSpawnpoint","i", playerid);
TextDrawShowForPlayer(playerid, SpawnDraw[4]);
TextDrawShowForPlayer(playerid, SpawnDraw[5]);
return true;
}
}
TextDrawHideForPlayer(playerid, SideBar1);
TextDrawHideForPlayer(playerid, SideBar2);
ClearChatbox(playerid,50);
TogglePlayerSpectating(playerid, 0);
SetCameraBehindPlayer(playerid);
SpawnPlayer(playerid);
SetSpawnInfo(playerid, 0, GetPVarInt(playerid,"Model"), GetPVarFloat(playerid, "PosX"),GetPVarFloat(playerid, "PosY"),GetPVarFloat(playerid, "PosZ"), 0.0, 0, 0, 0, 0, 0, 0);
SetPlayerSkinEx(playerid, GetPVarInt(playerid,"Model"));
SetPlayerPosEx(playerid, GetPVarFloat(playerid, "PosX"), GetPVarFloat(playerid, "PosY"), GetPVarFloat(playerid, "PosZ"));
SetPlayerInterior(playerid,GetPVarInt(playerid, "Interior"));
SetPlayerVirtualWorld(playerid,GetPVarInt(playerid, "World"));
TogglePlayerControllable(playerid, false);
SetTimerEx("OnLoginInit", 1000, false, "ii", playerid, 2);
SetPlayerScore(playerid, GetPVarInt(playerid, "ConnectTime"));
SetCameraBehindPlayer(playerid);
mysql_format(handlesql, string, sizeof(string), "SELECT * FROM `adjust` WHERE `name`='%s'", PlayerInfo[playerid][pUsername]);
mysql_tquery(handlesql, string, "LoadHolsterSQL", "d", playerid);
for(new i = 0; i < 301; i++)
{
PlayerInfo[playerid][pBlockPM][i] = 0;
}
for(new i = 0; i < 6; i++)
{
TextDrawHideForPlayer(playerid, WoundDraw[i]);
}
for(new o = 1; o < 9; o++)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, o))
{
RemovePlayerAttachedObject(playerid, o);
}
}
for(new o = 0; o < 4; o++)
{
TextDrawHideForPlayer(playerid, PGBar[o][playerid]);
}
}
case 2:
{
SetPVarInt(playerid, "PlayerLogged", 1);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, true);
StopAudioStreamForPlayerEx(playerid);
SetPlayerColor(playerid, COLOR_WHITE);
if(GetPVarFloat(playerid, "Health") > 0.0) SetPlayerHealth(playerid,GetPVarFloat(playerid, "Health"));
if(PlayerInfo[playerid][pArmour] > 0.0) SetPlayerArmourEx(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.000000, 329.000000, " ");
TextDrawBackgroundColor(LocationDraw[playerid], 255);
TextDrawFont(LocationDraw[playerid], 2);
TextDrawLetterSize(LocationDraw[playerid], 0.280000, 1.000000);
TextDrawColor(LocationDraw[playerid], -1);
TextDrawSetOutline(LocationDraw[playerid], 0);
TextDrawSetProportional(LocationDraw[playerid], 1);
TextDrawSetShadow(LocationDraw[playerid], 1);
format(string, sizeof(string),"~w~%s", GetPlayerArea(playerid));
TextDrawSetString(Text:LocationDraw[playerid], string);
TextDrawShowForPlayer(playerid, LocationDraw[playerid]);
//==============================//
CallRemoteFunction("PrintHud","i",playerid);
//==============================//
format(query, sizeof(query), "UPDATE `accounts` SET `Online` = 1 WHERE `Name`='%s'", PlayerName(playerid));
mysql_tquery(handlesql, query);
//==============================//
LoadChecks(playerid);
//==============================//
format(string, sizeof(string), "SELECT * FROM `toys` WHERE `PlayerName`='%s'", PlayerName(playerid));
mysql_function_query(handlesql, string, true, "LoadToys", "d", playerid);
if(PlayerInfo[playerid][pPlayerWeapon] > 0 && PlayerInfo[playerid][pPlayerAmmo] > 0)
{
GivePlayerWeaponEx(playerid, PlayerInfo[playerid][pPlayerWeapon], PlayerInfo[playerid][pPlayerAmmo]);
}
//==============================//
new mem = GetPVarInt(playerid, "Member");
if(FactionInfo[mem][fUsed] == 1)
{
format(string, sizeof(string),"FACTION-MOTD: %s", FactionInfo[mem][fMOTD]);
SCM(playerid, 0xE65A5AAA, string);
}
else { SetPVarInt(playerid, "Member", 0), SetPVarInt(playerid, "Rank", 0); }
//==============================//
SCM(playerid, COLOR_LIGHTRED, "To follow up on updates visit our website @ www.diverseroleplay.org");
SCM(playerid, COLOR_LIGHTRED, "IMPORTANT: Please make sure your account is always linked to a valid email address. (/ucp -> Player Options)");
SCM(playerid, COLOR_LIGHTRED, "*Email addresses are kept private, and are only used for password-recovery purposes.*");
//==============================//
if(strcmp(PlayerInfo[playerid][pDescribe], " ", true) == 0) strmid(PlayerInfo[playerid][pDescribe], "None", 0, strlen("None"), 255);
if(strcmp(PlayerInfo[playerid][pDescribe2], " ", true) == 0) strmid(PlayerInfo[playerid][pDescribe2], "None", 0, strlen("None"), 255);
//==============================//
switch(GetPVarInt(playerid, "FightStyle"))
{
case 0: SetPlayerFightingStyle(playerid,FIGHT_STYLE_NORMAL);
case 1: SetPlayerFightingStyle(playerid,FIGHT_STYLE_BOXING);
case 2: SetPlayerFightingStyle(playerid,FIGHT_STYLE_KUNGFU);
case 3: SetPlayerFightingStyle(playerid,FIGHT_STYLE_KNEEHEAD);
case 4: SetPlayerFightingStyle(playerid,FIGHT_STYLE_GRABKICK);
case 5: SetPlayerFightingStyle(playerid,FIGHT_STYLE_ELBOW);
}
//==============================//
if(GetPVarInt(playerid, "Dead") == 1 || 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 1: ApplyAnimation(playerid, "ped", "FLOOR_hit", 4.0, 0, 1, 1, 1, -1);
case 2: ApplyAnimation(playerid, "ped", "FLOOR_hit_f", 4.0, 0, 1, 1, 1, -1);
case 3: ApplyAnimation(playerid, "ped", "KO_shot_front", 4.0, 0, 1, 1, 1, -1);
case 4: ApplyAnimation(playerid, "ped", "KO_shot_stom", 4.0, 0, 1, 1, 1, -1);
case 5: ApplyAnimation(playerid, "ped", "BIKE_fall_off", 4.0, 0, 1, 1, 1, -1);
default: ApplyAnimation(playerid, "FINALE", "FIN_Land_Die", 4.0, 0, 1, 1, 1, -1);
}
if(GetPVarInt(playerid, "Admin") != 10) SetPVarInt(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") == 1) SetPlayerAttachedObject(playerid, 6, 371, 1, 0.0, -0.14, 0.0, 0.0, 90, 359.5022, 1, 1, 1);
//==============================//
switch(GetPVarInt(playerid, "Jailed"))
{
case 1:
{
SetPlayerPosEx(playerid, -1406.7714,1245.1904,1029.8984);
SetPlayerFacingAngle(playerid, 177.0008);
SetPlayerInterior(playerid, 16);
SetPlayerVirtualWorld(playerid, playerid + 1);
format(string, sizeof(string),"[JAILED] You are in admin-jail for %d seconds.", GetPVarInt(playerid, "Jailtime"));
SCM(playerid, 0xE65A5AAA, string);
SetPVarInt(playerid, "Mute", 1);
}
case 2:
{
new ran = random(3) + 1;
if(ran == 1) SetPlayerPosEx(playerid, 2592.0681,-1506.9999,-48.9141);
else if(ran == 2) SetPlayerPosEx(playerid, 2588.0879,-1526.0541,-48.9141);
else SetPlayerPosEx(playerid, 2583.7458,-1526.5377,-48.9141);
SetPlayerInterior(playerid, 1);
SetPlayerVirtualWorld(playerid, 1);
SCM(playerid, 0xE65A5AAA, "[JAILED] You are in jail.");
}
}
//==============================//
if(IsPlayerInRangeOfPoint(playerid, 15.0, 2233.0278,2457.1990,-7.4531+10.0)) // UNBUG DEALERSHIP SYSTEM
{
SetPlayerPosEx(playerid, 1529.6,-1691.2,13.3);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
SendClientMessage(playerid, 0xFF000000, "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) == 0 && GetPlayerInterior(playerid) == 0 && GetPVarInt(playerid, "DrugTime") == 0) {
SetPlayerTime(playerid, GMHour, GMMin);
SetPlayerWeather(playerid, GMWeather);
}
//==============================//
}
}
return 1;
}
PHP код:
forward OnDealershipVehicleBought(playerid, carmdl, id3, col, price);
public OnDealershipVehicleBought(playerid, carmdl, id3, col, price) {
if(cache_get_row_count() < MaxVehicles(playerid)) {
new query[516], plate[VEHICLE_PLATE_MAX_LENGTH], rand = 1000 + random(99999999);
format(plate, VEHICLE_PLATE_MAX_LENGTH, "%d", rand);
mysql_format(handlesql, query, sizeof(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)", carmdl, Dealerships[id3][3], Dealerships[id3][4],
Dealerships[id3][5], Dealerships[id3][6], col, col, PlayerInfo[playerid][pUsername], price, 100, plate, 1000.0);
mysql_tquery(handlesql, query);
if(GetPVarInt(playerid, "CTU") == 1) {
SetPVarInt(playerid, "CarTicket", GetPVarInt(playerid, "CarTicket")-1);
DeletePVar(playerid, "CTU");
SendClientMessage(playerid, COLOR_WHITE, "Carticket used !");
}
if(GetPVarInt(playerid, "CTU") == 2) {
SetPVarInt(playerid, "CarTicket", GetPVarInt(playerid, "CarTicket")-1);
DeletePVar(playerid, "CTU");
format(query, sizeof(query), "Carticket used, paid the remainder of $%d!", price);
SendClientMessage(playerid, COLOR_WHITE, query);
GivePlayerMoneyEx(playerid, -price);
} else {
format(query, sizeof(query), "%s purchased for $%d !", VehicleName[carmdl-400], price);
SendClientMessage(playerid, COLOR_WHITE, query);
GivePlayerMoneyEx(playerid, -price);
new car = CreateVehicle(carmdl, Dealerships[id3][3], Dealerships[id3][4], Dealerships[id3][5], Dealerships[id3][6], col, col, 1);
SetVehicleVirtualWorld(car, 0);
LinkVehicleToInterior(car, 6);
}
OnPlayerDataSave(playerid);
VJB=1;
} else {
SendClientMessage(playerid, COLOR_GREY, "You cannot buy another vehicle as you've reached the maximum amount of vehicles per-player.");
}
}