19.08.2016, 08:02
My script had alot of errors :V
and sometimes this error
Error:
1-OnPlayerEnterCheckpoint
OnPlayerDeath i'll try to remove some Latest things :P
2-OnVehicleDeath
Any Solution ?
Код:
[00:45:01] [debug] Run time error 4: "Array index out of bounds" [00:45:01] [debug] Accessing element at index 5 past array upper bound 4 [00:45:01] [debug] AMX backtrace: [00:45:01] [debug] #0 0015764c in public OnPlayerEnterCheckpoint (2) from _dark_.amx [00:45:07] [debug] Run time error 4: "Array index out of bounds" [00:45:07] [debug] Accessing element at index 5 past array upper bound 4 [05:30:28] [debug] Run time error 4: "Array index out of bounds" [05:30:28] [debug] Accessing element at index 65535 past array upper bound 99 [05:30:28] [debug] AMX backtrace: [05:30:28] [debug] #0 0008de88 in public FC_OnPlayerDeath (0, 65535, 255) from _dark_.amx [05:30:28] [debug] #1 native CallLocalFunction () from samp03svr [05:30:28] [debug] #2 0000e2f8 in public OnPlayerDeath (0, 65535, 255) from _dark_.amx [05:31:07] [debug] #0 00157ec4 in public OnVehicleDeath (401, 1) from _dark_.amx [05:32:53] [debug] Run time error 4: "Array index out of bounds" [05:32:53] [debug] Accessing element at index 65535 past array upper bound 99
Код:
[22:58:21] [connection] 39.42.29.193:3113 requests connection cookie. [22:58:23] [connection] 39.42.29.193:3113 requests connection cookie. [23:12:05] [connection] 197.129.68.75:60194 requests connection cookie. [23:12:36] Kicking 197.129.68.75 because they didn't logon to the game.
1-OnPlayerEnterCheckpoint
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
new text[128];
if(IsCapturing[playerid][usapro] == 1)
{
if(IsPlayerInVehicle(playerid, usapro))
{
DisablePlayerCheckpoint(playerid);
IsCapturing[playerid][usapro] = 0;
format(text, sizeof(text), "~r~%s~w~ has Captured ~r~USA prototype ~w~for his team!", pName(playerid));
RemovePlayerFromVehicle(playerid);
SCM(playerid, C_GREEN, "Congratulations! You got +6 score and +6000 cash!");
GivePlayerMoney(playerid, 6000);
SetVehicleToRespawn(usapro);
SetPlayerScore(playerid, GetPlayerScore(playerid)+6);
TogglePlayerAllDynamicCPs(playerid, 1);
TextStats(playerid);
Savestatus(playerid);
}
else
{
DisablePlayerCheckpoint(playerid);
SCM(playerid, RED, "You're not in the USA Prototype.");
}
}
if(IsCapturing[playerid][auspro] == 1)
{
if(IsPlayerInVehicle(playerid, auspro))
{
DisablePlayerCheckpoint(playerid);
IsCapturing[playerid][auspro] = 0;
TextStats(playerid);
Savestatus(playerid);
format(text, sizeof(text), "~r~%s~w~ has Captured ~r~ Australia prototype ~w~for his team!", pName(playerid));
RemovePlayerFromVehicle(playerid);
SCM(playerid, C_GREEN, "Congratulations! You got +6 score and +6000 cash!");
GivePlayerMoney(playerid, 6000);
SetVehicleToRespawn(auspro);
SetPlayerScore(playerid, GetPlayerScore(playerid)+6);
TogglePlayerAllDynamicCPs(playerid, 1);
}
else
{
DisablePlayerCheckpoint(playerid);
SCM(playerid, RED, "You're not in the Australia Prototype.");
}
}
if(IsCapturing[playerid][arabpro] == 1)
{
if(IsPlayerInVehicle(playerid, arabpro))
{
DisablePlayerCheckpoint(playerid);
IsCapturing[playerid][arabpro] = 0;
TextStats(playerid);
Savestatus(playerid);
format(text, sizeof(text), "~r~%s~w~ has Captured ~r~Arabian prototype ~w~for his team!", pName(playerid));
RemovePlayerFromVehicle(playerid);
SCM(playerid, C_GREEN, "Congratulations! You got +6 score and +6000 cash!");
GivePlayerMoney(playerid, 6000);
SetVehicleToRespawn(arabpro);
SetPlayerScore(playerid, GetPlayerScore(playerid)+6);
TogglePlayerAllDynamicCPs(playerid, 1);
}
else
{
DisablePlayerCheckpoint(playerid);
SCM(playerid, RED, "You're not in the Arabian Prototype.");
}
}
if(IsCapturing[playerid][sovpro] == 1)
{
if(IsPlayerInVehicle(playerid, sovpro))
{
DisablePlayerCheckpoint(playerid);
RemovePlayerFromVehicle(playerid);
TextStats(playerid);
Savestatus(playerid);
format(text, sizeof(text), "~r~%s~w~ has Captured ~r~Soviet prototype ~w~for his team!", pName(playerid));
IsCapturing[playerid][sovpro] = 0;
SCM(playerid, C_GREEN, "Congratulations! You got +6 score and +6000 cash!");
GivePlayerMoney(playerid, 6000);
SetVehicleToRespawn(sovpro);
SetPlayerScore(playerid, GetPlayerScore(playerid)+6);
TogglePlayerAllDynamicCPs(playerid, 1);
}
else
{
DisablePlayerCheckpoint(playerid);
SCM(playerid, RED, "You're not in the Soviet Prototype.");
}
}
if(IsCapturing[playerid][eurapro] == 1)
{
if(IsPlayerInVehicle(playerid, eurapro))
{
DisablePlayerCheckpoint(playerid);
format(text, sizeof(text), "~r~%s~w~ has Captured ~r~Erusia prototype ~w~for his team!", pName(playerid));
IsCapturing[playerid][eurapro] = 0;
RemovePlayerFromVehicle(playerid);
TextStats(playerid);
Savestatus(playerid);
SCM(playerid, C_GREEN, "Congratulations! You got +6 score and +6000 cash!");
GivePlayerMoney(playerid, 6000);
SetVehicleToRespawn(eurapro);
SetPlayerScore(playerid, GetPlayerScore(playerid)+6);
TogglePlayerAllDynamicCPs(playerid, 1);
}
else
{
DisablePlayerCheckpoint(playerid);
SCM(playerid, RED, "You're not in the Erusia Prototype.");
}
}
return 1;
}
2-OnVehicleDeath
PHP код:
public OnVehicleDeath(vehicleid, killerid)
{
new text[128];
if(IsCapturing[killerid][usapro] == 1)
{
if(vehicleid == usapro)
{
DisablePlayerCheckpoint(killerid);
IsCapturing[killerid][usapro] = 0;
format(text, sizeof(text), "%s has failed to capture the USA Prototype.", pName(killerid));
SendClientMessageToAll( RED, text);
TogglePlayerAllDynamicCPs(killerid, 1);
}
}
if(IsCapturing[killerid][auspro] == 1)
{
if(vehicleid == auspro)
{
DisablePlayerCheckpoint(killerid);
IsCapturing[killerid][auspro] = 0;
format(text, sizeof(text), "%s has failed to capture the Australian Prototype.", pName(killerid));
SendClientMessageToAll( RED, text);
TogglePlayerAllDynamicCPs(killerid, 1);
}
}
if(IsCapturing[killerid][sovpro] == 1)
{
if(vehicleid == sovpro)
{
DisablePlayerCheckpoint(killerid);
IsCapturing[killerid][sovpro] = 0;
format(text, sizeof(text), "%s has failed to capture the Arabian Prototype.", pName(killerid));
SendClientMessageToAll( RED, text);
TogglePlayerAllDynamicCPs(killerid, 1);
}
}
if(IsCapturing[killerid][eurapro] == 1)
{
if(vehicleid == eurapro)
{
DisablePlayerCheckpoint(killerid);
IsCapturing[killerid][eurapro] = 0;
format(text, sizeof(text),"%s has failed to capture the Arabian Prototype.", pName(killerid));
SendClientMessageToAll( RED, text);
TogglePlayerAllDynamicCPs(killerid, 1);
}
}
new Float:P[3]; GetVehiclePos(vehicleid, P[0], P[1], P[2]);
if(P[2] <= 0.4) return true;
new model = GetVehicleModel(vehicleid);
switch(model)
{
case PLANES: return true;
case HELIS: return true;
default:
{
new
ht = random(EFFECT_RANDOM),
xang = random(EFFECT_RANDOM)-EFFECT_FIX_DEFAULT,
yang = random(EFFECT_RANDOM)-EFFECT_FIX_DEFAULT,
zang = random(EFFECT_RANDOM)
;
GetVehiclePos(vehicleid, P[0], P[1], P[2]);
CreateExplosion(P[0], P[1], P[2]+EFFECT_EXPLOSIONOFFSET, EFFECT_EXPLOSIONTYPE, EFFECT_EXPLOSIONRADIUS);
SetVehicleAngularVelocity(vehicleid, xang*EFFECT_MULTIPLIER, yang*EFFECT_MULTIPLIER, zang*EFFECT_FIX_Z);
GetVehicleVelocity(vehicleid, P[0], P[1], P[2]);
SetVehicleVelocity(vehicleid, P[0], P[1], P[2] + (ht*EFFECT_FIX_Z) );
}
}
return 1;
}