kondzixd
03-24-2015, 17:36
Hi.
I have a problem with AddCommandListener. It does not work at all.
I try to catch when player push "slot1"
public OnPluginStart()
{
AddCommandListener(ChangeWeapon_1, "slot1");
}
public Action:ChangeWeapon_1(client, const String:command[], argc)
{
if(aktualna_liczba_broni_dlugich[client])
{
ZapiszAmmo(client);
new slot = ZwrocSlot(client)
new weaponIndex = -1
weaponIndex = GetPlayerWeaponSlot(client, 0);
if(weaponIndex != -1)
{
RemovePlayerItem(client, weaponIndex);
RemoveEdict(weaponIndex);
}
switch(slot)
{
case BRON_DLUGA:
{
if(++aktualna_bron_dluga[client] >= aktualna_liczba_broni_dlugich[client])
aktualna_bron_dluga[client] = 0;
GivePlayerItem(client, player_weapons[client][aktualna_bron_dluga[client]][0]);
DajAmmo(client, 0);
}
case BRON_KROTKA:
{
GivePlayerItem(client, player_weapons[client][aktualna_bron_dluga[client]][0]);
DajAmmo(client, 0);
}
case NOZ:
{
GivePlayerItem(client, player_weapons[client][aktualna_bron_dluga[client]][0]);
DajAmmo(client, 0);
}
case GRANATY:
{
GivePlayerItem(client, player_weapons[client][aktualna_bron_dluga[client]][0]);
DajAmmo(client, 0);
}
case C4:
{
GivePlayerItem(client, player_weapons[client][aktualna_bron_dluga[client]][0]);
DajAmmo(client, 1);
}
}
}
return Plugin_Continue;
}
What I doing wrong?
I have a problem with AddCommandListener. It does not work at all.
I try to catch when player push "slot1"
public OnPluginStart()
{
AddCommandListener(ChangeWeapon_1, "slot1");
}
public Action:ChangeWeapon_1(client, const String:command[], argc)
{
if(aktualna_liczba_broni_dlugich[client])
{
ZapiszAmmo(client);
new slot = ZwrocSlot(client)
new weaponIndex = -1
weaponIndex = GetPlayerWeaponSlot(client, 0);
if(weaponIndex != -1)
{
RemovePlayerItem(client, weaponIndex);
RemoveEdict(weaponIndex);
}
switch(slot)
{
case BRON_DLUGA:
{
if(++aktualna_bron_dluga[client] >= aktualna_liczba_broni_dlugich[client])
aktualna_bron_dluga[client] = 0;
GivePlayerItem(client, player_weapons[client][aktualna_bron_dluga[client]][0]);
DajAmmo(client, 0);
}
case BRON_KROTKA:
{
GivePlayerItem(client, player_weapons[client][aktualna_bron_dluga[client]][0]);
DajAmmo(client, 0);
}
case NOZ:
{
GivePlayerItem(client, player_weapons[client][aktualna_bron_dluga[client]][0]);
DajAmmo(client, 0);
}
case GRANATY:
{
GivePlayerItem(client, player_weapons[client][aktualna_bron_dluga[client]][0]);
DajAmmo(client, 0);
}
case C4:
{
GivePlayerItem(client, player_weapons[client][aktualna_bron_dluga[client]][0]);
DajAmmo(client, 1);
}
}
}
return Plugin_Continue;
}
What I doing wrong?