Code not running. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Code not running. (
/showthread.php?tid=625431)
Code not running. -
SukMathcuck - 01.01.2017
Hello, I'm trying a problem in the code but I can not, what's the problem? Simple, the player can drop only one item at a time, for example, I dropped one AK47 and can not drop another. I've debugged, there's no use.
Common questions.
What happens when you drop more than one item? Ae shows an error in the script, I will show what is not executed, I will show the part.
In short, a certain part of the code is not executed, so you can not drop more than one item at a time.
PHP код:
stock DroparArma(playerid, ArmaID, ArmaAmmo, Float:X, Float:Y, Float:Z, world, interior)
{
new name[MAX_PLAYER_NAME], gunname[128];
GetWeaponName(ArmaID, gunname, sizeof(gunname));
GetPlayerName(playerid,name,sizeof(name));
if(ArmaID != 0 && ArmaAmmo != 0)
{
for(new i = 0; i < sizeof(ArmasInfo); i++)
{
if(ArmasInfo[i][ArmaPosX] == 0.0 && ArmasInfo[i][ArmaPosY] == 0.0 && ArmasInfo[i][ArmaPosZ] == 0.0)
{ //On that down line does not run
ArmasInfo[i][ArmaInfo][0] = ArmaID;
ArmasInfo[i][ArmaInfo][1] = ArmaAmmo;
ArmasInfo[i][ArmaPosX] = X;
ArmasInfo[i][ArmaPosY] = Y;
ArmasInfo[i][ArmaPosZ] = Z;
ArmasInfo[i][ArmaWorld] = world;
ArmasInfo[i][ArmaInterior] = interior;
ApplyAnimation(playerid, "BOMBER", "BOM_PLANT_IN", 10000.0, 0, 0, 0, 0, 0);
ArmaDropada[i] = CreateObject(GetGunObjectID(ArmaID), X, Y, Z-1, 80.0, 0.0, 0.0, world);
format(strglobal, sizeof(strglobal), "%s\n(%d)", gunname, ArmaAmmo);
ObjetoDropado2 = Create3DTextLabel(strglobal, -1, X, Y, Z-1, 3.0, world, 0);
RemovePlayerWeapon(playerid, GetPlayerWeapon(playerid));
return 1;
}
return 1;
}
return 1;
}
return 1;
}
PHP код:
if(ArmasInfo[i][ArmaPosX] == 0.0 && ArmasInfo[i][ArmaPosY] == 0.0 && ArmasInfo[i][ArmaPosZ] == 0.0)
Re: Code not running. -
Spmn - 01.01.2017
Код:
stock DroparArma(playerid, ArmaID, ArmaAmmo, Float:X, Float:Y, Float:Z, world, interior)
{
new name[MAX_PLAYER_NAME], gunname[128];
GetWeaponName(ArmaID, gunname, sizeof(gunname));
GetPlayerName(playerid,name,sizeof(name));
if(ArmaID != 0 && ArmaAmmo != 0)
{
for(new i = 0; i < sizeof(ArmasInfo); i++)
{
if(ArmasInfo[i][ArmaPosX] == 0.0 && ArmasInfo[i][ArmaPosY] == 0.0 && ArmasInfo[i][ArmaPosZ] == 0.0)
{ //On that down line does not run
ArmasInfo[i][ArmaInfo][0] = ArmaID;
ArmasInfo[i][ArmaInfo][1] = ArmaAmmo;
ArmasInfo[i][ArmaPosX] = X;
ArmasInfo[i][ArmaPosY] = Y;
ArmasInfo[i][ArmaPosZ] = Z;
ArmasInfo[i][ArmaWorld] = world;
ArmasInfo[i][ArmaInterior] = interior;
ApplyAnimation(playerid, "BOMBER", "BOM_PLANT_IN", 10000.0, 0, 0, 0, 0, 0);
ArmaDropada[i] = CreateObject(GetGunObjectID(ArmaID), X, Y, Z-1, 80.0, 0.0, 0.0, world);
format(strglobal, sizeof(strglobal), "%s\n(%d)", gunname, ArmaAmmo);
ObjetoDropado2 = Create3DTextLabel(strglobal, -1, X, Y, Z-1, 3.0, world, 0);
RemovePlayerWeapon(playerid, GetPlayerWeapon(playerid));
return 1;
}
return 1; // Remove this line
}
return 1;
}
return 1;
}