AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help with some errors (https://forums.alliedmods.net/showthread.php?t=89747)

TitANious 04-10-2009 04:19

Need help with some errors
 
PHP Code:

#include <amxmodx> 
#include <fun> 
#include <fakemeta> 
#include <hamsandwich>
#include <cstrike>

#define PLUGIN "ScoutKnifeZ_Manager" 
#define VERSION "0.1" 
#define AUTHOR "TitANious" 

new gCvarEnabled
new gCvarGravity800
new gCvarGravity600
new gCvarGravity400
new gCvarGravity200
new gCvarGravity100
new gCvarSG550
new gCvarG3SG1
new gCvarAWP
new gCvarRespawn
new gCvar_respawndelay

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR
    
register_clcmd("say /SKM","cmdScoutKnifeZMenu") ,
    
register_clcmd("say_team /SKM","cmdScoutKnifeZMenu"
    
RegisterHam(Ham_DeathNotice"player""player_death"1);
    
register_clcmd("say_team respawn""StartSpawn")
    
register_clcmd("say respawn""StartSpawn")
    
register_plugin("Player""Respawn""Test")
    
register_event("DeathMsg""event_deathmsg""a")
    
    
gCvar_respawndelay register_cvar("amx_respawndelay""5.0"// Delay before respawning
    
gCvarEnabled register_cvar("SKM_enabled""1")
    
gCvarGravity800 register_cvar("SKM_g800""1")
    
gCvarGravity600 register_cvar("SKM_g600""1")
    
gCvarGravity400 register_cvar("SKM_g400""1")
    
gCvarGravity200 register_cvar("SKM_g200""1")
    
gCvarGravity100 register_cvar("SKM_g100""1")
    
gCvarSG550 register_cvar("SKM_SG550""1")
    
gCvarG3SG1 register_cvar("SKM_G3SG1""1")
    
gCvarAWP register_cvar("SKM_AWP""1")
    
gCvarRespawn register_cvar("Respawn""1")

public 
cmdScoutKnifeZMenu(id

    if(!
get_pcvar_num(gCvarEnabled))
    return;
    new 
menu menu_create ("\rMenu for ScoutKnifeZ_Manager!:""handleScoutKnifeZMenu"
    
menu_additem(menu"\wGravity800""1"0
    
menu_additem(menu"\wGravity600""2"0
    
menu_additem(menu"\wGravity400""3"0
    
menu_additem(menu"\wGravity200""4"0
    
menu_additem(menu"\wGravity100""5"0
    
menu_additem(menu"\wGiveSg550""6"0
    
menu_additem(menu"\wGiveAWP""7"0
    
menu_additem(menu"\wGiveG3sg1""8"0
    
menu_display(idmenu0


public 
handleScoutKnifeZMenu(idmenuitem

    if (
item == MENU_EXIT
    { 
        
menu_destroy(menu
        return 
PLUGIN_HANDLED 
    

    new 
data[6], iName[64
    new 
accesscallback 
    
    menu_item_getinfo
(menuitemaccessdata,5iName63callback
    {
    new 
key str_to_num(data
   }
    switch(
1)
    {
        case 
1
        { 
    if(
get_pcvar_num(gCvarGravity800))
            
set_user_gravity(id1.0
            
client_print(idprint_chat"You have 800 gravity isnt that normal?"
        } 
        case 
2
        {
    if(
get_pcvar_num(gCvarGravity600))
            
set_user_gravity(id0.75
            
client_print(idprint_chat"600 gravity, a bit less than 800, nothing less?"
        } 
        case 
3
        { 
    if(
get_pcvar_num(gCvarGravity400))
            
set_user_gravity(id0.5
            
client_print(idprint_chat"400, the half of normal!"
        } 
        case 
4
        { 
    if(
get_pcvar_num(gCvarGravity200))
            
set_user_gravity(id0.25
            
client_print(idprint_chat"200, the half of 400, you jump high now"
        } 
        case 
5
        { 
    if(
get_pcvar_num(gCvarGravity100))
            
set_user_gravity(id0.125
            
client_print(idprint_chat"100, the less in the whole server!"
        } 
        case 
6
        { 
    if(
get_pcvar_num(gCvarSG550))
            
client_cmd(id"slot1; drop"
            
give_itemid"weapon_sg550" )
            
give_itemid"ammo_556nato"
            
give_itemid"ammo_556nato"
            
give_itemid"ammo_556nato"
            
give_itemid"ammo_556nato"
            
give_itemid"ammo_556nato"
            
client_print(idprint_chat"Didnt i deleted SG550?!"
        } 
        case 
7
        { 
    if(
get_pcvar_num(gCvarG3SG1))
            
client_cmd(id"slot1; drop"
            
give_item(id"weapon_g3sg1" 
            
give_item(id"ammo_762nato"
            
give_item(id"ammo_762nato"
            
give_item(id"ammo_762nato"
            
give_item(id"ammo_762nato"
            
give_item(id"ammo_762nato"
            
give_item(id"ammo_762nato"
            
client_print(idprint_chat"Did you really buy a G3SG1?!"
        } 
        case 
8
        { 
    if(
get_pcvar_num(gCvarAWP))
            
client_cmd(id"slot1; drop"
            
give_itemid"weapon_awp" 
            
give_itemid"ammo_338magnum" 
            
give_itemid"ammo_338magnum" 
            
give_itemid"ammo_338magnum" 
            
give_itemid"ammo_338magnum" 
            
give_itemid"ammo_338magnum" 
            
client_print(idprint_chat"Isnt a AWP forbidden?!"
        } 
    } 

    
menu_destroy(menu
    return 
PLUGIN_HANDLED 

public event_deathmsg(id)
{
    
// read_data(2) = victim
    
set_task(get_pcvar_float(cvar_respawndelay), "respawn_player"read_data(2))
}

public 
respawn_player(id)
{
    if(
get_pcvar_num(gCvarRespawn))
    
// Disconnected, already spawned, or switched to Spectator
    
if (!is_user_connected(id) || is_user_alive(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR)
        return;
    
    
// (Debug only)
    
client_print(0print_chat"Player %d is being respawned"id)
    
    
// Try to spawn the player setting the appropiate dead flag and forcing a think
    
set_pev(idpev_deadflagDEAD_RESPAWNABLE)
    
dllfunc(DLLFunc_Thinkid)
    
    
// Fix for CZ Bots: DLLFunc_Think won't work on them,
    // but DLLFunc_Spawn does the job without any bugs.
    // (for some reason I'm not suprised...)
    
if (is_user_bot(id) && pev(idpev_deadflag) == DEAD_RESPAWNABLE)
    {
        
dllfunc(DLLFunc_Spawnid)
    }


Code:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Warning: Symbol is assigned a value that is never used: "key" on line 75
Warning: Loose indentation on line 82
Warning: Loose indentation on line 88
Warning: Loose indentation on line 94
Warning: Loose indentation on line 100
Warning: Loose indentation on line 106
Warning: Loose indentation on line 112
Warning: Loose indentation on line 124
Warning: Loose indentation on line 137
Warning: Unreachable code on line 150
Warning: Loose indentation on line 150
Error: Invalid expression, assumed zero on line 150
Error: Undefined symbol "event_deathmsg" on line 150
Error: Undefined symbol "cvar_respawndelay" on line 153
Error: Invalid expression, assumed zero on line 156
Error: Undefined symbol "respawn_player" on line 156
Warning: Function "handleScoutKnifeZMenu" should return a value on line 161
Warning: Loose indentation on line 164
Error: Expected token: "}", but found "-end of file-" on line 177

6 Errors.
Could not locate output file C:\Users\Jacob\Desktop\ScoutKnifeZ_Manager.amx (compile failed).

Why?..

xPaw 04-10-2009 04:35

Re: Need help with some errors
 
Use ham to respawn player..

PHP Code:

#include <amxmodx> 
#include <fun> 
#include <fakemeta> 
#include <hamsandwich>
#include <cstrike>

#define PLUGIN "ScoutKnifeZ_Manager" 
#define VERSION "0.1" 
#define AUTHOR "TitANious" 

new gCvarEnabled
new gCvarGravity800
new gCvarGravity600
new gCvarGravity400
new gCvarGravity200
new gCvarGravity100
new gCvarSG550
new gCvarG3SG1
new gCvarAWP
new gCvarRespawn
new gCvar_respawndelay

public plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR
    
register_clcmd("say /SKM","cmdScoutKnifeZMenu") ,
    
register_clcmd("say_team /SKM","cmdScoutKnifeZMenu"
    
RegisterHam(Ham_DeathNotice"player""player_death"1);
    
register_clcmd("say_team respawn""StartSpawn")
    
register_clcmd("say respawn""StartSpawn")
    
register_plugin("Player""Respawn""Test")
    
register_event("DeathMsg""event_deathmsg""a")
    
    
gCvar_respawndelay register_cvar("amx_respawndelay""5.0"// Delay before respawning
    
gCvarEnabled register_cvar("SKM_enabled""1")
    
gCvarGravity800 register_cvar("SKM_g800""1")
    
gCvarGravity600 register_cvar("SKM_g600""1")
    
gCvarGravity400 register_cvar("SKM_g400""1")
    
gCvarGravity200 register_cvar("SKM_g200""1")
    
gCvarGravity100 register_cvar("SKM_g100""1")
    
gCvarSG550 register_cvar("SKM_SG550""1")
    
gCvarG3SG1 register_cvar("SKM_G3SG1""1")
    
gCvarAWP register_cvar("SKM_AWP""1")
    
gCvarRespawn register_cvar("Respawn""1")
}

public 
cmdScoutKnifeZMenuid ) {
    if(!
get_pcvar_num(gCvarEnabled))
        return;
    
    new 
menu menu_create ("\rMenu for ScoutKnifeZ_Manager!:""handleScoutKnifeZMenu"
    
menu_additem(menu"\wGravity800""1"0
    
menu_additem(menu"\wGravity600""2"0
    
menu_additem(menu"\wGravity400""3"0
    
menu_additem(menu"\wGravity200""4"0
    
menu_additem(menu"\wGravity100""5"0
    
menu_additem(menu"\wGiveSg550""6"0
    
menu_additem(menu"\wGiveAWP""7"0
    
menu_additem(menu"\wGiveG3sg1""8"0
    
menu_display(idmenu0


public 
handleScoutKnifeZMenu(idmenuitem)  {
    if (
item == MENU_EXIT
    { 
        
menu_destroy(menu
        return 
PLUGIN_HANDLED 
    

    new 
data[6], iName[64
    new 
accesscallback 
    
    menu_item_getinfo
(menuitemaccessdata,5iName63callback
    new 
key str_to_num(data
    
    switch( 
key)
    {
        case 
1
        { 
            if(
get_pcvar_num(gCvarGravity800)) {
                
set_user_gravity(id1.0
                
client_print(idprint_chat"You have 800 gravity isnt that normal?")
            }
        } 
        case 
2
        {
            if(
get_pcvar_num(gCvarGravity600)) {
                
set_user_gravity(id0.75
                
client_print(idprint_chat"600 gravity, a bit less than 800, nothing less?"
            }
        } 
        case 
3
        { 
            if(
get_pcvar_num(gCvarGravity400)) {
                
set_user_gravity(id0.5
                
client_print(idprint_chat"400, the half of normal!"
            }
        } 
        case 
4
        { 
            if(
get_pcvar_num(gCvarGravity200)) {
                
set_user_gravity(id0.25
                
client_print(idprint_chat"200, the half of 400, you jump high now")
            }
        } 
        case 
5
        { 
            if(
get_pcvar_num(gCvarGravity100)) {
                
set_user_gravity(id0.125
                
client_print(idprint_chat"100, the less in the whole server!"
            }
        } 
        case 
6
        { 
            if(
get_pcvar_num(gCvarSG550)) {
                
client_cmd(id"slot1; drop"
                
give_itemid"weapon_sg550" )
                
give_itemid"ammo_556nato"
                
give_itemid"ammo_556nato"
                
give_itemid"ammo_556nato"
                
give_itemid"ammo_556nato"
                
give_itemid"ammo_556nato"
                
client_print(idprint_chat"Didnt i deleted SG550?!"
            }
        } 
        case 
7
        { 
            if(
get_pcvar_num(gCvarG3SG1)) {
                
client_cmd(id"slot1; drop"
                
give_item(id"weapon_g3sg1" 
                
give_item(id"ammo_762nato"
                
give_item(id"ammo_762nato"
                
give_item(id"ammo_762nato"
                
give_item(id"ammo_762nato"
                
give_item(id"ammo_762nato"
                
give_item(id"ammo_762nato"
                
client_print(idprint_chat"Did you really buy a G3SG1?!"
            }
        } 
        case 
8
        { 
            if(
get_pcvar_num(gCvarAWP)) {
                
client_cmd(id"slot1; drop"
                
give_itemid"weapon_awp" 
                
give_itemid"ammo_338magnum" 
                
give_itemid"ammo_338magnum" 
                
give_itemid"ammo_338magnum" 
                
give_itemid"ammo_338magnum" 
                
give_itemid"ammo_338magnum" 
                
client_print(idprint_chat"Isnt a AWP forbidden?!"
            }
        } 
    } 
    
    
menu_destroy(menu
    return 
PLUGIN_HANDLED 
}

public 
event_deathmsg(id)
{
    
// read_data(2) = victim
    
set_task(get_pcvar_float(gCvar_respawndelay), "respawn_player"read_data(2))
}

public 
respawn_player(id)
{
    if(
get_pcvar_num(gCvarRespawn))
    
// Disconnected, already spawned, or switched to Spectator
    
if (!is_user_connected(id) || is_user_alive(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR)
        return;
    
    
// (Debug only)
    
client_print(0print_chat"Player %d is being respawned"id)
    
    
// Try to spawn the player setting the appropiate dead flag and forcing a think
    
set_pev(idpev_deadflagDEAD_RESPAWNABLE)
    
dllfunc(DLLFunc_Thinkid)
    
    
// Fix for CZ Bots: DLLFunc_Think won't work on them,
    // but DLLFunc_Spawn does the job without any bugs.
    // (for some reason I'm not suprised...)
    
if (is_user_bot(id) && pev(idpev_deadflag) == DEAD_RESPAWNABLE)
    {
        
dllfunc(DLLFunc_Spawnid)
    }



Anggara_nothing 04-10-2009 04:38

Re: Need help with some errors
 
PHP Code:

#include <amxmodx> 
#include <fun> 
#include <fakemeta> 
#include <hamsandwich>
#include <cstrike>

#define PLUGIN "ScoutKnifeZ_Manager" 
#define VERSION "0.1" 
#define AUTHOR "TitANious" 

new gCvarEnabled
new gCvarGravity800
new gCvarGravity600
new gCvarGravity400
new gCvarGravity200
new gCvarGravity100
new gCvarSG550
new gCvarG3SG1
new gCvarAWP
new gCvarRespawn
new gCvar_respawndelay

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR
    
register_clcmd("say /SKM","cmdScoutKnifeZMenu") ,
    
register_clcmd("say_team /SKM","cmdScoutKnifeZMenu"
    
RegisterHam(Ham_DeathNotice"player""player_death"1);
    
register_clcmd("say_team respawn""StartSpawn")
    
register_clcmd("say respawn""StartSpawn")
    
register_plugin("Player""Respawn""Test")
    
register_event("DeathMsg""event_deathmsg""a")
    
    
gCvar_respawndelay register_cvar("amx_respawndelay""5.0"// Delay before respawning
    
gCvarEnabled register_cvar("SKM_enabled""1")
    
gCvarGravity800 register_cvar("SKM_g800""1")
    
gCvarGravity600 register_cvar("SKM_g600""1")
    
gCvarGravity400 register_cvar("SKM_g400""1")
    
gCvarGravity200 register_cvar("SKM_g200""1")
    
gCvarGravity100 register_cvar("SKM_g100""1")
    
gCvarSG550 register_cvar("SKM_SG550""1")
    
gCvarG3SG1 register_cvar("SKM_G3SG1""1")
    
gCvarAWP register_cvar("SKM_AWP""1")
    
gCvarRespawn register_cvar("Respawn""1")

public 
cmdScoutKnifeZMenu(id

    if(!
get_pcvar_num(gCvarEnabled))
    return;
    new 
menu menu_create ("\rMenu for ScoutKnifeZ_Manager!:""handleScoutKnifeZMenu"
    
menu_additem(menu"\wGravity800""1"0
    
menu_additem(menu"\wGravity600""2"0
    
menu_additem(menu"\wGravity400""3"0
    
menu_additem(menu"\wGravity200""4"0
    
menu_additem(menu"\wGravity100""5"0
    
menu_additem(menu"\wGiveSg550""6"0
    
menu_additem(menu"\wGiveAWP""7"0
    
menu_additem(menu"\wGiveG3sg1""8"0
    
menu_display(idmenu0


public 
handleScoutKnifeZMenu(idmenuitem

    if (
item == MENU_EXIT
    { 
        
menu_destroy(menu
        return 
PLUGIN_HANDLED 
    

    new 
data[6], iName[64
    new 
accesscallback 
    
    menu_item_getinfo
(menuitemaccessdata,5iName63callback
    {
    new 
key str_to_num(data
    }
    switch(
1)
    {
        case 
1
        { 
            if(
get_pcvar_num(gCvarGravity800))
            {
            
set_user_gravity(id1.0
            
client_print(idprint_chat"You have 800 gravity isnt that normal?"
            } 
        }
        case 
2
        {
        if(
get_pcvar_num(gCvarGravity600))
        {
            
set_user_gravity(id0.75
            
client_print(idprint_chat"600 gravity, a bit less than 800, nothing less?"
        }
        } 
        case 
3
        { 
        if(
get_pcvar_num(gCvarGravity400))
        {
        
set_user_gravity(id0.5
        
client_print(idprint_chat"400, the half of normal!"
        } 
        }
        case 
4
        { 
        if(
get_pcvar_num(gCvarGravity200))
        {
        
set_user_gravity(id0.25
        
client_print(idprint_chat"200, the half of 400, you jump high now"
        } 
        }
        case 
5
        { 
        if(
get_pcvar_num(gCvarGravity100))
        {
        
set_user_gravity(id0.125
        
client_print(idprint_chat"100, the less in the whole server!"
        } 
        }
        case 
6
        { 
        if(
get_pcvar_num(gCvarSG550))
        {
        
client_cmd(id"slot1; drop"
        
give_itemid"weapon_sg550" )
        
give_itemid"ammo_556nato"
        
give_itemid"ammo_556nato"
        
give_itemid"ammo_556nato"
        
give_itemid"ammo_556nato"
        
give_itemid"ammo_556nato"
        
client_print(idprint_chat"Didnt i deleted SG550?!"
        }
        } 
        case 
7
        { 
        if(
get_pcvar_num(gCvarG3SG1))
        {
        
client_cmd(id"slot1; drop"
        
give_item(id"weapon_g3sg1" 
        
give_item(id"ammo_762nato"
        
give_item(id"ammo_762nato"
        
give_item(id"ammo_762nato"
        
give_item(id"ammo_762nato"
        
give_item(id"ammo_762nato"
        
give_item(id"ammo_762nato"
        
client_print(idprint_chat"Did you really buy a G3SG1?!"
        } 
        }
        case 
8
        { 
        if(
get_pcvar_num(gCvarAWP))
        {
        
client_cmd(id"slot1; drop"
        
give_itemid"weapon_awp" 
        
give_itemid"ammo_338magnum" 
        
give_itemid"ammo_338magnum" 
        
give_itemid"ammo_338magnum" 
        
give_itemid"ammo_338magnum" 
        
give_itemid"ammo_338magnum" 
        
client_print(idprint_chat"Isnt a AWP forbidden?!"
        } 
        }
    }

    
menu_destroy(menu
    return 
PLUGIN_HANDLED
}

public 
event_deathmsg(id)
{
    
// read_data(2) = victim
    
set_task(get_pcvar_float(gCvar_respawndelay), "respawn_player"read_data(2))
}

public 
respawn_player(id)
{
    if(
get_pcvar_num(gCvarRespawn))
    
// Disconnected, already spawned, or switched to Spectator
    
if (!is_user_connected(id) || is_user_alive(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR)
        return;
    
    
// (Debug only)
    
client_print(0print_chat"Player %d is being respawned"id)
    
    
// Try to spawn the player setting the appropiate dead flag and forcing a think
    
set_pev(idpev_deadflagDEAD_RESPAWNABLE)
    
dllfunc(DLLFunc_Thinkid)
    
    
// Fix for CZ Bots: DLLFunc_Think won't work on them,
    // but DLLFunc_Spawn does the job without any bugs.
    // (for some reason I'm not suprised...)
    
if (is_user_bot(id) && pev(idpev_deadflag) == DEAD_RESPAWNABLE)
    {
        
dllfunc(DLLFunc_Spawnid)
    }



TitANious 04-10-2009 05:03

Re: Need help with some errors
 
Thanks it works :) Do you think there is a easyer way to strip slot1 so you not drop it, but keep it

xPaw 04-10-2009 05:11

Re: Need help with some errors
 
you want give 2nd weapon without dropping first?
if yes, just remove this line
PHP Code:

 client_cmd(id"slot1; drop"


TitANious 04-10-2009 05:25

Re: Need help with some errors
 
I mean if you delete it, they just pile in the same slot


All times are GMT -4. The time now is 02:26.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.