Raised This Month: $ Target: $400
 0% 

Cannot find tag mismatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 02-05-2010 , 18:06   Cannot find tag mismatch
Reply With Quote #1

I cannot find why im getting the errors in line 26 and 47-47.
Both of them use Ownerteam inside the code. Whats the problem?

Its anti-team seems to not be working. Any ideas?

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <engine>

new owner
new Ownerteam

public plugin_init()
{
    
register_plugin("Nade-Slap","1.0","r4nDoMz")
    
register_cvar("nslap_dmg""5")
    
register_touch("grenade""player""touch_nade")
    
register_cvar("amx_nslap""1")
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_hegrenade""Nadethrow"// If the user throws a nade, we get the origin of it in the function
        
RegisterHamHam_Weapon_PrimaryAttack"weapon_flashbang""Nadethrow")
        
RegisterHamHam_Weapon_PrimaryAttack"weapon_smokegrenade""Nadethrow")
}

public 
touch_nade(nadeid)
{

    new 
hitTeam cs_get_user_team(id)
  
    if(
Ownerteam == hitTeam)
    {
        return
    }

    if(!
get_cvar_num("amx_nslap"))
    {
        return
    }

    
entity_set_edict(nadeEV_ENT_aimentid)
    
user_slap(idget_cvar_num("nslap_dmg"), 0)
    
entity_set_int(nadeEV_INT_sequence0)
}



public 
Nadethrow()
{
    
pev(pev_ownerowner)
    
Ownerteam cs_get_user_team(owner)

Code:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// nade-slap.sma
// C:\Documents and Settings\nick\Desktop\compiler1\nade-slap.sma(26) : warning
213: tag mismatch
// C:\Documents and Settings\nick\Desktop\compiler1\nade-slap.sma(46 -- 47) : wa
rning 213: tag mismatch
// Header size:            676 bytes
// Code size:             1400 bytes
// Data size:              752 bytes
// Stack/heap size:      16384 bytes; estimated max. usage=42 cells (168 bytes)
// Total requirements:   19212 bytes
//
// 2 Warnings.
// Done.
//
// Compilation Time: 0.7 sec
// ----------------------------------------

Press enter to exit ...
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME

Last edited by r4ndomz; 02-05-2010 at 18:15. Reason: spelling error
r4ndomz is offline
Send a message via Skype™ to r4ndomz
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-05-2010 , 18:08   Re: Cannot find tag mismatch
Reply With Quote #2

You should learn bases first.
There are a lot of critical errors in your code. Tag mismatch are minor errors.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 02-05-2010 , 18:22   Re: Cannot find tag mismatch
Reply With Quote #3

I've only corrected the tag mismatch warnings, not the critical errors
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <engine>

new owner
new CsTeams:Ownerteam

public plugin_init()
{
    
register_plugin("Nade-Slap","1.0","r4nDoMz")
    
register_cvar("nslap_dmg""5")
    
register_touch("grenade""player""touch_nade")
    
register_cvar("amx_nslap""1")
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_hegrenade""Nadethrow"// If the user throws a nade, we get the origin of it in the function
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_flashbang""Nadethrow")
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_smokegrenade""Nadethrow")
}

public 
touch_nade(nadeid)
{
    new 
CsTeams:hitTeam cs_get_user_team(id)
  
    if(
Ownerteam == hitTeam)
    {
        return
    }

    if(!
get_cvar_num("amx_nslap"))
    {
        return
    }

    
entity_set_edict(nadeEV_ENT_aimentid)
    
user_slap(idget_cvar_num("nslap_dmg"), 0)
    
entity_set_int(nadeEV_INT_sequence0)
}



public 
Nadethrow()
{
    
pev(pev_ownerowner)
    
Ownerteam cs_get_user_team(owner)

Seta00 is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 02-05-2010 , 18:50   Re: Cannot find tag mismatch
Reply With Quote #4

Then what are the critical errors?
I did ask why the team thing wasnt working
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 02-05-2010 , 19:41   Re: Cannot find tag mismatch
Reply With Quote #5

1) On Nadethrow, pev(pev_owner, owner) should be owner = pev(nade_id, pev_owner). And there's no reason for owner to be a global variable.
2) You should use pcvars.
3) Your logic is in the right way, but in a real situation it gets tricky. What if a player throws a grenade, then another player throws another one before the first grenade hits someone? A think a nice approach will be to store the id of the thrown grenade, then in touch_nade check if the id of the touching grenade matches the id of the thrown nade. Then you check for the players teams.
Seta00 is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 02-05-2010 , 19:52   Re: Cannot find tag mismatch
Reply With Quote #6

i tried it and it says undefined symbol nade_id?
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 02-05-2010 , 20:01   Re: Cannot find tag mismatch
Reply With Quote #7

nade_id was just a placeholder, you have to find the thrown grenade's id and use it.
Seta00 is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 02-05-2010 , 20:02   Re: Cannot find tag mismatch
Reply With Quote #8

How would i do that?

Should i use:

http://www.amxmodx.org/funcwiki.php?go=func&id=398 --- get_grenade

or

http://www.amxmodx.org/funcwiki.php?go=func&id=369 --- get_grenade_id

get_grenade says this: Gets the grenade is thrown by a user. That doesn't make much sense
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME

Last edited by r4ndomz; 02-05-2010 at 20:04.
r4ndomz is offline
Send a message via Skype™ to r4ndomz
Old 02-05-2010, 20:11
Seta00
This message has been deleted by Seta00.
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 02-05-2010 , 20:13   Re: Cannot find tag mismatch
Reply With Quote #9

You should use get_grenade_id, but it seems not possible to detect the player who fired Ham_Weapon_PrimaryAttack.

Found it: grenade_throw has everything you need.
Seta00 is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-05-2010 , 20:14   Re: Cannot find tag mismatch
Reply With Quote #10

This is from my nadeslap plugin.

PHP Code:
public hfw_NadeThrow(e_NadeThrown)
{
    
peve_NadeThrownpev_originf_ThrowOrigin // Get the origin of the nade right as it is thrown

    
peve_NadeThrownpev_ownerpl_Owner // Get ID of player who throws the nade

    
ownerTeam cs_get_user_teampl_Owner // His team

    
get_user_namepl_Ownersz_ThrowerNamecharsmaxsz_ThrowerName ) ) // His name

__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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