I'm pretty new to this forum, but I hope you can help me a bit
So I've modified a little knife plugin for me and my friends on a LAN server and I get some errors.
Code:
public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (GetClientTeam(client) > 1 && !IsPlayerAlive(client))
{
return;
}
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_knife_tactical");}
case 7: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE)
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knife_butterfly");}
case 8: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE)
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knife_push");}
case 9: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE)
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knife_survival_bowie");}
default: {return;}
}
EquipPlayerWeapon(client, iItem);
}
I get the following error (sometimes, I cant meassure when.):
Code:
L 02/21/2017 - 16:00:50: [SM] Exception reported: World not allowed
L 02/21/2017 - 16:00:50: [SM] Blaming: KNIFE.smx
L 02/21/2017 - 16:00:50: [SM] Call stack trace:
L 02/21/2017 - 16:00:50: [SM] [0] EquipPlayerWeapon
L 02/21/2017 - 16:00:50: [SM] [1] Line 359, /home/groups/sourcemod/upload_tmp/phpjiKbkU.sp::PlayerSpawn