public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(weaponid == 24)
{
Create3DTextLabel("Desert Eagle Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
}
if(weaponid == 31)
{
Create3DTextLabel("M416 Assult rifle Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
}
if(weaponid == 30)
{
Create3DTextLabel("AK-47 Assult rifle Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
}
if(weaponid == 22)
{
Create3DTextLabel("9MM Pistol Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
}
if(weaponid == 23)
{
Create3DTextLabel("9MM Silencer Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
}
if(weaponid == 25)
{
Create3DTextLabel("Remington ShotGun Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
}
if(weaponid == 28)
{
Create3DTextLabel("UZI SMG Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
}
if(weaponid == 29)
{
Create3DTextLabel("MP5 SMG Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
}
if(weaponid == 32)
{
Create3DTextLabel("TEC9 SMG Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
}
if(weaponid == 33)
{
Create3DTextLabel("Contry Rifle Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
}
if(weaponid == 34)
{
Create3DTextLabel("Sniper Rifle Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
}
return true;
}
#define MAX_SHELLS 1000 //Or whatever you want the maximum to be.
#define ShellDespawnTime 300000 //Currently 5 minutes, set it to what you want it.
new Text3D:Shell[MAX_SHELLS]; //So each shell has it's own 3DTextLabel.
new ExistentShells; //In order to know which shell is which.
new ShellDespawnTimer[MAX_SHELLS]; //A timer for each shell to despawn
new shellid; //A variable to define shell ID's (used for the timers)
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(weaponid != 24 && weaponid!= 31 && weaponid !=30 && weaponid !=22 && weaponid != 23 && weaponid != 25 && weaponid != 28 && weaponid != 29 && weaponid != 32 && weaponid != 33 && weaponid != 34) return 0; //Making sure only the weapons below create shells (add add onto the variable "ExistentShells"
ExistentShells++; //Showing how many existent shells there are in order to establish a shell ID
switch(weaponid)
{
case 24: Shell[ExistentShells] = Create3DTextLabel("Desert Eagle Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
case 31: Shell[ExistentShells] = Create3DTextLabel("M416 Assult rifle Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
case 30: Shell[ExistentShells] = Create3DTextLabel("AK-47 Assult rifle Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
case 22: Shell[ExistentShells] = Create3DTextLabel("9MM Pistol Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
case 23: Shell[ExistentShells] = Create3DTextLabel("9MM Silencer Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
case 25: Shell[ExistentShells] = Create3DTextLabel("Remington ShotGun Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
case 28: Shell[ExistentShells] = Create3DTextLabel("UZI SMG Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
case 29: Shell[ExistentShells] = Create3DTextLabel("MP5 SMG Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
case 32: Shell[ExistentShells] = Create3DTextLabel("TEC9 SMG Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
case 33: Shell[ExistentShells] = Create3DTextLabel("Contry Rifle Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
case 34: Shell[ExistentShells] = Create3DTextLabel("Sniper Rifle Shell", COLOR_GREY, X, Y, Z, 30.0, 0, 0);
}
shellid = ExistentShells;
ShellDespawnTimer[shellid] = SetTimerEx("ShellDespawn", ShellDespawnTime, false, "i", shellid);
return 1;
}
forward ShellDespawn(shellid);
public ShellDespawn(shellid)
{
Delete3DTextLabel(Shell[shellid]);
return 1;
}
Well, what you should do:
pawn Код:
|
warning 219: local variable "shellid" shadows a variable at a preceding level the line : public ShellDespawn(shellid) |
new shellid;
Delete:
pawn Код:
|