Warunek dodaje w miejscach
public display_knife(id) {
new menuBody[512]
add(menuBody, 511, "\rKnife Mod\w^n^n")
add(menuBody, 511, "1. Machete \y(More Damage/Low Speed)\w^n")
add(menuBody, 511, "2. Bak Knife \y(No Footsteps)\w^n")
add(menuBody, 511, "3. Pocket Knife \y(High Speed)\w^n")
add(menuBody, 511, "4. Butcher Knife \y(Low Gravity)\w^n")
if(!is_user_connected(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
return PLUGIN_HANDLED;
add(menuBody, 511, "5. Default Knife \y(Health Regeneration)\w^n^n")
add(menuBody, 511, "0. Exit^n")
new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 )
show_menu(id, keys, menuBody, -1, "Knife Mod")
}
Wtedy po wpisaniu komendy /knife menu wyświetli się, jeśli gracz ma flagę
public knifemenu(id, key) {
switch(key)
{
case 0: SetKnife(id , 4)
if(!is_user_connected(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
return PLUGIN_HANDLED;
case 1: SetKnife(id , 2)
case 2: SetKnife(id , 3)
case 3: SetKnife(id , 1)
case 4: SetKnife(id , 0)
default: return PLUGIN_HANDLED
}
SaveData(id)
return PLUGIN_HANDLED
}
Mam błędy podczas kompilacji, tutaj podaje błędy
//// knife_mod.sma
// C:\Documents and Settings\Witek\Pulpit\scripting WINDOWS\knife_mod.sma(79) :
error 002: only a single statement (or expression) can follow each "case"
// C:\Documents and Settings\Witek\Pulpit\scripting WINDOWS\knife_mod.sma(81) :
warning 225: unreachable code
// C:\Documents and Settings\Witek\Pulpit\scripting WINDOWS\knife_mod.sma(81) :
error 014: invalid statement; not in switch
// C:\Documents and Settings\Witek\Pulpit\scripting WINDOWS\knife_mod.sma(81) :
warning 215: expression has no effect
// C:\Documents and Settings\Witek\Pulpit\scripting WINDOWS\knife_mod.sma(81) :
error 001: expected token: ";", but found ":"
// C:\Documents and Settings\Witek\Pulpit\scripting WINDOWS\knife_mod.sma(81) :
error 029: invalid expression, assumed zero
// C:\Documents and Settings\Witek\Pulpit\scripting WINDOWS\knife_mod.sma(81) :
fatal error 107: too many error messages on one line
//
Gdy dam tu
public SetKnife(id , Knife) {
knife_model[id] = Knife
new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)
if ( Weapon != CSW_KNIFE )
return PLUGIN_HANDLED
new vModel[56],pModel[56]
switch(Knife)
{
case 0: {
format(vModel,55,"models/v_knife.mdl")
format(pModel,55,"models/p_knife.mdl")
}
case 1: {
format(vModel,55,"models/knife-mod/v_butcher.mdl")
format(pModel,55,"models/knife-mod/p_butcher.mdl")
if(!is_user_connected(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
return PLUGIN_HANDLED;
}
case 2: {
format(vModel,55,"models/knife-mod/v_bak.mdl")
format(pModel,55,"models/knife-mod/p_bak.mdl")
}
case 3: {
format(vModel,55,"models/knife-mod/v_pocket.mdl")
format(pModel,55,"models/knife-mod/p_pocket.mdl")
}
case 4: {
format(vModel,55,"models/knife-mod/v_machete.mdl")
format(pModel,55,"models/knife-mod/p_machete.mdl")
}
}
entity_set_string(id, EV_SZ_viewmodel, vModel)
entity_set_string(id, EV_SZ_weaponmodel, pModel)
return PLUGIN_HANDLED;
}
Gracz dostanie moc, a modelu nie
Nwm może dasz radę to jakoś ogarnąć (bo mnie to przerasta ) i podesłać *sma, ewentualnie wycinek kodu w którym dasz warunek