AlliedModders

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

jonnzus 01-31-2013 17:14

Need bit help :)
 
Can someone explain what I have done wrong, and how I could fix it?
And what about ; ?
When it's needed in pawn?

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <csx>


new String:command[] = "gal_startvote"//Command witch is executed when team has winscores.
new String:winningMsg[] = "";
new 
CTKILLS 0;
new 
TKILLS 0;
new 
winscores 10;

/*
enum winningteam {
    CT = 0,
    T = 1,
    TIE = 2
}
*/

new winningteam 0;


public 
plugin_init() {
    
register_plugin("DeathMach Win""1.0.0""Jonuz")
    
register_clcmd("/status""scoreStatus")
    
register_clcmd("/winning""informer")
}

    public 
getKills(attacker) {
        if (
cs_get_user_team(attacker) == CS_TEAM_CT) {
        
CTKILLS++
    }
        if (
cs_get_user_team(attacker) == CS_TEAM_T) {
        
TKILLS++
    }}

    public 
scoreStatus(id) {
        
client_print (id,print_chat"Ct have: %CTKILLS kills.")
        
client_print (id,print_chat"Terrorist have: %TKILLS kills.")
    }

    public 
Win() {
        if (
CTKILLS == winscores) {
            
server_print ("Counter terrorist team has won game.")
            
server_cmd ("gal_startvote")
    }
        
        if (
TKILLS == winscores) {
            
server_print ("Terrorist steam has won game.")
            
server_cmd (command)
    }}

    public 
informer () {

        if (
CTKILLS TKILLS) {
            
winningteam 0
        
} else if (CTKILLS TKILLS) {
            
winningteam 1
        
} else if (CTKILLS == TKILLS) {
            
winningteam 2
        
}

        if (
winningteam 0) {
            
winningMsg "Ct needs  winscores - CTKILLS kill to win game.";
        } else if (
winningteam 1) {
            
winningMsg "Terrorist team need winninscores - TKILLS kill to win game.";
        }
            
        
server_print (winningMsg)
        
winningMsg "";
        } 

Compile error:
Code:

csdmwin.sma(7) : warning 213: tag mismatch
csdmwin.sma(8) : warning 213: tag mismatch
csdmwin.sma(51) : warning 213: tag mismatch
csdmwin.sma(64) : warning 211: possibly unintended assignment
csdmwin.sma(65) : error 047: array sizes do not match, or destination array is too small
csdmwin.sma(66) : warning 211: possibly unintended assignment
csdmwin.sma(67) : error 047: array sizes do not match, or destination array is too small
csdmwin.sma(70) : warning 213: tag mismatch
csdmwin.sma(71) : warning 213: tag mismatch
csdmwin.sma(73) : warning 204: symbol is assigned a value that is never used: "winningteam"


YamiKaitou 01-31-2013 17:52

Re: Need bit help :)
 
There is no String tag in AMXX Pawn

jonnzus 01-31-2013 17:58

Re: Need bit help :)
 
So I should not look this wiki for programming amxx?
http://wiki.amxmodx.org/Pawn_Tutorial#Strings

YamiKaitou 01-31-2013 18:00

Re: Need bit help :)
 
Read the comment above it, only applicable to SourcePawn, which is used by Sourcemod

P1raten 01-31-2013 18:19

Re: Need bit help :)
 
Semicolon is not required in pawn.

jonnzus 01-31-2013 18:59

Re: Need bit help :)
 
Okay, thanks for answers.

jonnzus 01-31-2013 19:10

Re: Need bit help :)
 
Should this work?
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <csx>

#define WINCOMMAND "quit"

new CTKILLS 0
new TKILLS 0
new winscores 10

const TASK_MESSAGE 12349;
new 
winningteam 0


public plugin_init() {
    
register_plugin("DeathMach Win""1.0.0""Jonuz")
    
register_clcmd("/status""scorestatus")
    
register_clcmd("/winning""informer")
    
set_task(0.2"informer"1)
}

    public 
getKills(attacker) {
        if (
cs_get_user_team(attacker) == CS_TEAM_CT) {
        
CTKILLS++
    }
        if (
cs_get_user_team(attacker) == CS_TEAM_T) {
        
TKILLS++
    }}

    public 
scorestatus(id) {
        
client_print (id,print_chat"Counter-Terrorist's kills:" ,CTKILLS)
        
client_print (id,print_chat"Terrorist's kills:"TKILLS)
    }

    public 
Win(id) {
        if (
CTKILLS == winscores) {
            
client_print (id,print_chat"Counter terrorist team has won game.")
            
server_cmd ("quit")
    }
        
        if (
TKILLS == winscores) {
            
client_print (id,print_chat"Terrorist steam has won game.")
            
server_cmd ("quit")
    }}

    public 
informer(id) {

        if (
CTKILLS TKILLS) {
            
winningteam 0
        
} else if (CTKILLS TKILLS) {
            
winningteam 1
        
} else if (CTKILLS == TKILLS) {
            
winningteam 2
        
}

        switch (
winningteam) {
            case 
0: {
             
client_print (id,print_chat"Ct needs  winscores - CTKILLS kill to win game.")
        }
            case 
1: {
             
client_print (id,print_chat"Terrorist team need  winscores - TKILLS  kill to win game.")
        }}} 

e. Plugin in compiling without any errors, but it wont do anything in server, any suggestions what I have done wrong?

P1raten 02-01-2013 05:43

Re: Need bit help :)
 
Quote:

Originally Posted by jonnzus (Post 1884350)
Stuff.

Are you getting any runtime errors?

jonnzus 02-01-2013 06:36

Re: Need bit help :)
 
Nope.

P1raten 02-01-2013 12:45

Re: Need bit help :)
 
Quote:

Originally Posted by jonnzus (Post 1884580)
Nope.

Just wondering: Why are you using set task when you could just hook the DeathMsg Event?

What you are trying to do is check for kills on each team. And since we have a function which is called every time a player dies it's probably better to use that.


All times are GMT -4. The time now is 20:29.

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