AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   can anyone help me....plz (https://forums.alliedmods.net/showthread.php?t=25190)

martins 03-09-2006 17:08

can anyone help me....plz
 
i just edit a plugin called sameipsameteam
i made it but it can not work...can you help me??thx...here is the code
Code:

/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "Same IP Same Team"
#define VERSION "1.0"
#define AUTHOR "martins"

public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        register_plugin(PLUGIN, VERSION, AUTHOR)
        register_cvar("amx_sameIPsameTeam","1")
        register_logevent( "Event_RoundStart", 2, "0=World triggered", "1=Round_Start" )
        return PLUGIN_CONTINUE
}
public Event_RoundStart(){
       
        if((get_cvar_num("amx_sameipsameteam") == 1)){
               

        new players[32],ip[32][32],name[32][32]
        new playerscount,total_count = 0,ct_count = 0,t_count = 1,m=0,n
        get_players(players,playerscount,"c")       
        for( new i = 0 ; i <playerscount ; i++) {
                get_user_ip(players[i],ip[i],31) //get IP
                console_print(0,"ip[ %i ] is %s",i,ip[i])
        }
        for (new a = 0;a<playerscount;a++){ //get IP[a] from 1 to x
                for (new b = a+1;b<playerscount;b++){  //get ip[b] from 2 to x
                        if (equali(ip[a],ip[b])) { //ip is same
                        n = a
                        get_user_name(players[b],name[m],31)
                        m = m + 1
                        total_count = total_count + 1
                }
                }
        get_user_name(players[n],name[m],31)
        for(new j=0;j<=m;j++){
                new aa = get_user_index(name[j])
                new CsTeams:userTeam = cs_get_user_team(players[aa])
                if (userTeam == CS_TEAM_CT) {
                        ct_count = ct_count + 1
                }
                else if (userTeam == CS_TEAM_T){
                        t_count = t_count + 1
                }
        }
        if (ct_count >= t_count){       
                for(new x=0;x<=m;x++){
                        new bb = get_user_index(name[x])
                        cs_set_user_team(bb,2)
                        client_print(0,print_chat,"players %s change team for same ip: %s",name[x],ip[n])
                }
                }else{
                for(new y=0;y<=m;y++){
                        new cc = get_user_index(name[y])
                        cs_set_user_team(cc,1)
                        client_print(0,print_chat,"players %s change team for same ip: %s",name[y],ip[n])
                }
        }
       
}
}
return PLUGIN_HANDLED
}


Des12 03-09-2006 17:15

Re: can anyone help me....plz
 
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN "Same IP Same Team" #define VERSION "1.0" #define AUTHOR "martins" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_cvar("amx_sameIPsameTeam","1")     register_logevent( "Event_RoundStart", 2, "0=World triggered", "1=Round_Start" )     } public Event_RoundStart(){         if((get_cvar_num("amx_sameipsameteam") == 1)){                new players[32],ip[32][32],name[32][32]        new playerscount,total_count = 0,ct_count = 0,t_count = 1,m=0,n        get_players(players,playerscount,"c")           for( new i = 0 ; i <playerscount ; i++) {         get_user_ip(players[i],ip[i],31) //get IP         console_print(0,"ip[ %i ] is %s",i,ip[i])        }        for (new a = 0;a<playerscount;a++){ //get IP[a] from 1 to x         for (new b = a+1;b<playerscount;b++){  //get ip[b] from 2 to x             if (equali(ip[a],ip[b])) { //ip is same                n = a                get_user_name(players[b],name[m],31)                m = m + 1                total_count = total_count + 1                }        }        get_user_name(players[n],name[m],31)        for(new j=0;j<=m;j++){         new aa = get_user_index(name[j])         new CsTeams:userTeam = cs_get_user_team(players[aa])         if (userTeam == CS_TEAM_CT) {             ct_count = ct_count + 1         }         else if (userTeam == CS_TEAM_T){             t_count = t_count + 1         }        }        if (ct_count >= t_count){            for(new x=0;x<=m;x++){             new bb = get_user_index(name[x])             cs_set_user_team(bb,2)             client_print(0,print_chat,"players %s change team for same ip: %s",name[x],ip[n])        }        }else{         for(new y=0;y<=m;y++){             new cc = get_user_index(name[y])             cs_set_user_team(cc,1)             client_print(0,print_chat,"players %s change team for same ip: %s",name[y],ip[n])              }        }       }     return PLUGIN_HANDLED }

martins 03-09-2006 17:20

no...it can not work...[/quote]

martins 03-09-2006 17:22

perhaps any wrong with it......but i can not find out...

Des12 03-09-2006 17:22

Edit: Try my updated version

martins 03-09-2006 17:24

HERE IS THE ERRORS:
L 03/10/2006 - 06:11:38: [CSTRIKE] Player out of range (0)
L 03/10/2006 - 06:11:38: [AMXX] Displaying debug trace (plugin "sameIPsameTeam.a
mxx")
L 03/10/2006 - 06:11:38: [AMXX] Run time error 10: native error (native "cs_get_
user_team")
L 03/10/2006 - 06:11:38: [AMXX] [0] sameIPsameTeam.sma::Event_RoundStart (lin
e 42)

Des12 03-09-2006 17:27

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN "Same IP Same Team" #define VERSION "1.0" #define AUTHOR "martins" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_cvar("amx_sameIPsameTeam","1")     register_event ( "RoundStart", "Event_RoundStart", "a" )     } public Event_RoundStart(){         if((get_cvar_num("amx_sameipsameteam") == 1)){                new players[32],ip[32][32],name[32][32]        new playerscount,total_count = 0,ct_count = 0,t_count = 1,m=0,n        get_players(players,playerscount,"c")            for( new i = 0 ; i <playerscount ; i++) {         get_user_ip(players[i],ip[i],31) //get IP         console_print(0,"ip[ %i ] is %s",i,ip[i])        }        for (new a = 0;a<playerscount;a++){ //get IP[a] from 1 to x         for (new b = a+1;b<playerscount;b++){  //get ip[b] from 2 to x             if (equali(ip[a],ip[b])) { //ip is same                n = a                get_user_name(players[b],name[m],31)                m = m + 1                total_count = total_count + 1                }        }        get_user_name(players[n],name[m],31)        for(new j=0;j<=m;j++){         new aa = get_user_index(name[j])         new CsTeams:userTeam = cs_get_user_team(players[aa])         if (userTeam == CS_TEAM_CT) {             ct_count = ct_count + 1         }         else if (userTeam == CS_TEAM_T){             t_count = t_count + 1         }        }        if (ct_count >= t_count){             for(new x=0;x<=m;x++){             new bb = get_user_index(name[x])             cs_set_user_team(bb,2)             client_print(0,print_chat,"players %s change team for same ip: %s",name[x],ip[n])        }        }else{         for(new y=0;y<=m;y++){             new cc = get_user_index(name[y])             cs_set_user_team(cc,1)             client_print(0,print_chat,"players %s change team for same ip: %s",name[y],ip[n])              }        }       }     return PLUGIN_HANDLED }

That may be an invalid event, don't do a lot of CS scripting, let me check

martins 03-09-2006 17:28

thx a lot first...

Des12 03-09-2006 17:37

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN "Same IP Same Team" #define VERSION "1.0" #define AUTHOR "martins" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_cvar("amx_sameIPsameTeam","1")      register_event("HLTV" , "Event_RoundStart" , "a" , "1=0" , "2=0");       } public Event_RoundStart(){         if((get_cvar_num("amx_sameipsameteam") == 1)){                new players[32],ip[32][32],name[32][32]        new playerscount,total_count = 0,ct_count = 0,t_count = 1,m=0,n        get_players(players,playerscount,"c")            for( new i = 0 ; i <playerscount ; i++) {         get_user_ip(players[i],ip[i],31) //get IP         console_print(0,"ip[ %i ] is %s",i,ip[i])        }        for (new a = 0;a<playerscount;a++){ //get IP[a] from 1 to x         for (new b = a+1;b<playerscount;b++){  //get ip[b] from 2 to x             if (equali(ip[a],ip[b])) { //ip is same                n = a                get_user_name(players[b],name[m],31)                m = m + 1                total_count = total_count + 1                }        }        get_user_name(players[n],name[m],31)        for(new j=0;j<=m;j++){         new aa = get_user_index(name[j])         new CsTeams:userTeam = cs_get_user_team(players[aa])         if (userTeam == CS_TEAM_CT) {             ct_count = ct_count + 1         }         else if (userTeam == CS_TEAM_T){             t_count = t_count + 1         }        }        if (ct_count >= t_count){             for(new x=0;x<=m;x++){             new bb = get_user_index(name[x])             cs_set_user_team(bb,2)             client_print(0,print_chat,"players %s change team for same ip: %s",name[x],ip[n])        }        }else{         for(new y=0;y<=m;y++){             new cc = get_user_index(name[y])             cs_set_user_team(cc,1)             client_print(0,print_chat,"players %s change team for same ip: %s",name[y],ip[n])              }        }       }     return PLUGIN_HANDLED }

martins 03-09-2006 17:45

thx.i'll try immediately....


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

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