Eu quando coloco a arma no carro ela vai multiplicando se eu nao sair do carro,
logo eu queria que quando eu posse-se uma arma no carro ele sai-se do carro e assim por exemplo
Код:
if(!strcmp(cmd, "/porarmacarro", true)) // by Klap
{
if(IsPlayerConnected(playerid))
{
new carro = GetPlayerVehicleID(playerid);
//new buyable = strval(tmp);
if(PlayerInfo[playerid][pChave] == carro || PlayerInfo[playerid][pChave2] == carro || PlayerInfo[playerid][pChave3] == carro || PlayerInfo[playerid][pChave4] == carro || PlayerInfo[playerid][pChave5] == carro || PlayerInfo[playerid][pChave6] == carro)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: /porarmacarro [slot]");
return 1;
}
if(CopOnDuty[playerid] == 1 || SegOnDuty[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "** Tбs em Duty Policial, Nao Aldrabes as tuas Armas!!!");
return 1;
}
new slot;
slot = strval(tmp);
new gunname[100];
new gunID = GetPlayerWeapon(playerid);
new gunAmmo = GetPlayerAmmo(playerid);
if(gunID != 0 && gunAmmo != 0)
{
if(slot < 1||slot > 3)
{
SendClientMessage(playerid, COLOR_GREY, "** Slot nao pode ser infrior a 1 ou suprior a 3!");
return 1;
}
if(slot == 1)
{
if(DynamicCars[carro][cWeapon1] != 0 || DynamicCars[carro][cAmmo1] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** Jб colocaste alguma coisa no Slot 1!");
return 1;
}
DynamicCars[carro][cWeapon1] = gunID;
DynamicCars[carro][cAmmo1] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** Tu puseste uma %s no teu Slot 1.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
RemovePlayerWeapon(playerid, gunID);
}
if(slot == 2)
{
if(DynamicCars[carro][cWeapon2] != 0 || DynamicCars[carro][cAmmo2] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** Jб colocaste alguma coisa no Slot 2!");
return 1;
}
DynamicCars[carro][cWeapon2] = gunID;
DynamicCars[carro][cAmmo2] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** Tu puseste uma %s no teu Slot 2.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
RemovePlayerWeapon(playerid, gunID);
}
if(slot == 3)
{
if(DynamicCars[carro][cWeapon3] != 0 || DynamicCars[carro][cAmmo3] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** Jб colocaste alguma coisa no Slot 3!");
return 1;
}
DynamicCars[carro][cWeapon3] = gunID;
DynamicCars[carro][cAmmo3] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** Tu puseste uma %s no teu Slot 3.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
RemovePlayerWeapon(playerid, gunID);
}
PlayerActionMessage(playerid,15.0,"Coloca algo na traseira do carro.");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "** Este veiculo nгo й teu!");
}
}
return 1;