AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Tag Mismatch? (https://forums.alliedmods.net/showthread.php?t=162236)

sake 07-16-2011 15:19

Tag Mismatch?
 
PHP Code:

/* Script generated by Pawn Studio */

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

#define PLUGIN    "csdmsake"
#define AUTHOR    "sake"
#define VERSION    "1.0"
#define NO_TEAM "UNASSIGNED"
#define SPEC    "SPECTATOR"

new sv_money 2000;

public 
plugin_init()
{
    if(
cstrike_running())
    {
        
register_plugin(PLUGINVERSIONAUTHOR);
        @
sv_money register_cvar("sv_money","2000",FCVAR_SERVER,2000);
        
RegisterHam(Ham_Spawn,"player","onPlayerSpawn",1)
        
register_event("DeathMsg""playerKilled""a");
        
register_event("TeamInfo""teamAssigned""a");
        
register_clcmd("say /unstuck""unstuck"0)
    }
}

public 
playerKilled()
{
    new 
victim read_data(2);
    
set_task(0.5,"spawnPlayer",victim);
    return 
PLUGIN_CONTINUE;
}

public 
onPlayerSpawn(id)
{
    if(
is_user_alive(id))
    {
        
give_item(id,"weapon_awp");
        new 
string [16];
        
format(string15"%d"cs_get_user_money(id)); 
        
show_hudmessage(0string);
        new 
money cs_get_user_money(id) + sv_money;
        
cs_set_user_money(idmoney);
    }
    return 
PLUGIN_CONTINUE;        
}

public 
spawnPlayer(id)
{
    new 
team cs_get_user_team(id)
    @if((
team == || team == 2) && !is_user_hltv(id))
    {
        
spawn(id);
    }
    return 
PLUGIN_CONTINUE;
}

public 
killUser(id)
{
    new 
team cs_get_user_team(id)
    @if((
team == || team == 2) && !is_user_hltv(id))
    {
        
user_kill(id);
    }
    return 
PLUGIN_CONTINUE;
}


public 
unstuck(id)
{
    
show_hudmessage(0,"unstucking Player!");
    
set_task(0.5,"spawnPlayer",id);
    
set_task(0.5,"killUser",id);
    return 
PLUGIN_CONTINUE;
}

public 
teamAssigned()
{
    new 
id read_data(1);
    new 
string[16];
    
read_data(2,string,15);
    if(
strcmp(string,NO_TEAM)==0||strcmp(string,SPEC))
    {
        return 
PLUGIN_CONTINUE;
    }
    if(!
is_user_alive(id))
    {
        
spawnPlayer(id);
    }
    return 
PLUGIN_CONTINUE;


I don't get it. Why do i get a compiler Warning that here (lines marked with @) are tag mismatches? What am I doing wrong?

I already had some issues with CS_TEAM_CT. So I changed it to 1 and 2.

greetings

sake

fysiks 07-16-2011 15:28

Re: Tag Mismatch?
 
You should read about how cvars work: http://forums.alliedmods.net/showthr...highlight=cvar

You have to give the team variable a tag:

PHP Code:

    new CsTeams:team cs_get_user_team(id

and use the CS_TEAM_* constants.

P.S. The @ thing for highlighting lines only works with [pawn][/pawn]

sake 07-16-2011 15:57

Re: Tag Mismatch?
 
Thanks about that. And what about that?

sv_money = register_cvar("sv_money","2000",FCVAR_SERVER, 2000);

fysiks 07-16-2011 16:29

Re: Tag Mismatch?
 
The tag mismatch is because the last argument needs to be a float. HOWEVER, you are doing the whole cvar thing incorrectly. Look at the first example in the thread that I posted.


All times are GMT -4. The time now is 01:08.

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