AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_user_attacker, not used properly? (https://forums.alliedmods.net/showthread.php?t=17819)

Zenith77 09-09-2005 18:46

get_user_attacker, not used properly?
 
I keep getting these errors because of the variable attacker that is suposed to be equal to the index of the attacker....


Code:

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

Warning: Tag mismatch on line 275
Warning: Symbol is never used: "weapon" on line 483
Warning: Tag mismatch on line 524
Warning: Expression has no effect on line 528
Warning: Symbol is never used: "attacker" on line 929
Warning: Symbol is never used: "origin" on line 929
Warning: Symbol is never used: "vector" on line 929
Header size:          2156 bytes
Code size:            29496 bytes
Data size:            27308 bytes
Stack/heap size:      16384 bytes; estimated max. usage=1617 cells (6468 bytes)
Total requirements:  75344 bytes

7 Warnings.
Done.

CODE :
Code:
public Damage(id) {     if( isBanned[id] == 1 ) {         return PLUGIN_HANDLED     }         new Float:origin[3], Float:coinorigin[3], Float:vector[3],   name[32],         attacker = get_user_attacker( id, hitzone )     damage_taken[id] = read_data( 2 )         get_user_name(attacker, name, 31 )             if( get_user_team(id) == get_user_team(attacker) ) {         client_print( attacker, print_chat, " [COIN MOD] STOP ATTACKING YOUR TEAMMATES OR YOUR COINS WILL BE TAKEN AWAY!" )                 timesAttackedTeamMate[attacker]++         coins[attacker] -=2                 if( get_cvar_num( "coinmod_debug" ) == 1 ) {             server_print( " [COIN MOD] Player %s attacked a teammate! Warnings Increased!", name )         }                 return PLUGIN_HANDLED     }         if( coinHasExtraDamage[attacker] ) {         new extraDamage = (damage_taken[id] + coinDamage[attacker]) - damage_taken[id]         coinExtraDamage( id, attacker, extraDamage, "0")     }         coin_bronze_ent = create_entity("info_target")     coin_silver_ent = create_entity("info_target")     coin_gold_ent = create_entity("info_target")           get_user_origin(attacker,origin, 0)     origin[2] += 5         if( coins[id] > 0 ) {         if( damage_taken[id] <= 25 ) {                         entity_set_origin(coin_bronze_ent,origin)                         entity_set_int(coin_bronze_ent, EV_INT_solid,2)                         entity_set_int(coin_bronze_ent,EV_INT_movetype,5)                         entity_set_float(coin_bronze_ent,EV_FL_framerate,1.0)                         entity_set_int(coin_bronze_ent,EV_INT_sequence,0)                         entity_set_edict(coin_bronze_ent,EV_ENT_owner,33)                         new Float:mina[3]             mina[0]=1.0             mina[1]=1.0             mina[2]=1.0             new Float:maxa[3]             maxa[0]=1.0             maxa[1]=1.0             maxa[2]=1.0             entity_set_size(coin_bronze_ent,mina,maxa)                         entity_set_string(coin_bronze_ent,EV_SZ_classname,"bronze_coin")             entity_set_model(coin_bronze_ent,"coin_mod/models/coin_bronze.mdl")                         entity_get_vector(attacker,EV_VEC_origin,origin)             entity_get_vector(coin_bronze_ent,EV_VEC_origin,coinorigin)                         vector[0] = origin[0] - coinorigin[0]             vector[1] = origin[1] - coinorigin[1]             vector[2] = origin[2] - coinorigin[2] + 80                         set_user_velocity(coin_bronze_ent,vector)         }                 if( damage_taken[id] < 25 && damage_taken[id] <= 50 ) {                         entity_set_origin(coin_silver_ent,origin)                         entity_set_int(coin_silver_ent, EV_INT_solid,2)                         entity_set_int(coin_silver_ent,EV_INT_movetype,5)                         entity_set_float(coin_silver_ent,EV_FL_framerate,1.0)                         entity_set_int(coin_silver_ent,EV_INT_sequence,0)                         entity_set_edict(coin_silver_ent,EV_ENT_owner,33)                         new Float:mina[3]             mina[0]=1.0             mina[1]=1.0             mina[2]=1.0             new Float:maxa[3]             maxa[0]=1.0             maxa[1]=1.0             maxa[2]=1.0             entity_set_size(coin_silver_ent,mina,maxa)                         entity_set_string(coin_silver_ent,EV_SZ_classname, "silver_coin" )             entity_set_model(coin_silver_ent, "coin_mod/models/coin_silver.mdl")                         entity_get_vector(attacker,EV_VEC_origin,origin)             entity_get_vector(coin_silver_ent,EV_VEC_origin,coinorigin)                         vector[0] = origin[0] - coinorigin[0]             vector[1] = origin[1] - coinorigin[1]             vector[2] = origin[2] - coinorigin[2] + 80                         set_user_velocity(coin_silver_ent,vector)         }                 if( damage_taken[id] > 50 ) {                         entity_set_origin(coin_silver_ent,origin)                         entity_set_int(coin_silver_ent, EV_INT_solid,2)                         entity_set_int(coin_silver_ent,EV_INT_movetype,5)                         entity_set_float(coin_silver_ent,EV_FL_framerate,1.0)                         entity_set_int(coin_silver_ent,EV_INT_sequence,0)                         entity_set_edict(coin_silver_ent,EV_ENT_owner,33)                         new Float:mina[3]             mina[0]=1.0             mina[1]=1.0             mina[2]=1.0             new Float:maxa[3]             maxa[0]=1.0             maxa[1]=1.0             maxa[2]=1.0             entity_set_size(coin_silver_ent,mina,maxa)                         entity_set_string(coin_gold_ent, EV_SZ_classname, "gold_coin" )             entity_set_model(coin_gold_ent, "coin_mod/models/coin_gold.mdl")                     entity_get_vector(attacker,EV_VEC_origin,origin)             entity_get_vector(coin_gold_ent,EV_VEC_origin,coinorigin)                         vector[0] = origin[0] - coinorigin[0]             vector[1] = origin[1] - coinorigin[1]             vector[2] = origin[2] - coinorigin[2] + 80                     set_user_velocity(coin_gold_ent,vector)                     }             }     if( coins[id] <= 0 ) {                 if( get_cvar_num( "coinmod_debug" ) == 1 ) {             server_print( "[COIN MOD] Player, %s, has no money! EFFECT: No coin entity spawned, and no increase to player attack added!", name )                     }         return PLUGIN_HANDLED     }         return PLUGIN_HANDLED     }

XxAvalanchexX 09-09-2005 18:54

I don't know which line is which number. I also don't know how the attacke variable was declared.

Zenith77 09-09-2005 19:02

It was decalered at the begging of the code..

#include <amxmodx>
//etc

new attacker


its talking about these lines...( sry exlude line 524 totaly different code! )

Code:
get_user_origin(attacker,origin, 0)

XxAvalanchexX 09-09-2005 19:16

get_user_origin returns an integer 3-dimension array, not a float. If you want it in float use entity_get_vector(attacker, EV_VEC_origin, origin)

Zenith77 09-09-2005 19:57

I'm confused :/

XxAvalanchexX 09-09-2005 20:44

An integer doesn't have a decimal. A float does. You make your variable like this:

Float:origin[3];

get_user_origin needs a variable like this:

origin[3];

Zenith77 09-09-2005 21:12

Nm..i fixed it...

p.s doing that will run into a bunch of other errors since entity_set_origin requires a float...but i fixed it... i just turned it into a float when it was declared there :)

XxAvalanchexX 09-09-2005 21:36

I know it would create more errors, which is why I said if you want a float you should use this instead of get_user_origin:

entity_get_vector(attacker, EV_VEC_origin, origin)


All times are GMT -4. The time now is 14:24.

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