Mam warunek dać tylko w tą jedną linie czy całość publica?
Ostatek kodu ma wyglądać tak?:
public Action:OnItemPickup(Handle:event, const String:name[], bool:dontBroadcast)
{
if(IsValidClient(client))
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
}
new iWeapon = GetPlayerWeaponSlot(client, 2);
new iItem;
switch(weapon_choose[client]) {
case 1: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE)
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_bayonet");}
case 2: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE)
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knife_gut");}
case 3: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE)
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knife_flip");}
case 4: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE)
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knife_m9_bayonet");}
case 5: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE)
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knife_karambit");}
case 6: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE)
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knifegg");}
case 7: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE)
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knife_tactical");}
default: {return;}
}
EquipPlayerWeapon(client, iItem);
}
stock bool:IsValidClient(client)
{
return bool:(client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client));
}
Użytkownik Rellik # edytował ten post 05.04.2015 08:38