AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Wierd respawn (https://forums.alliedmods.net/showthread.php?t=146973)

Len 01-03-2011 17:50

Wierd respawn
 
No armor or health showing, I tried with spawn(id) it does the same, think im missing something with ham respawn, help please

edit:
tried cs_set_user_armor and set_user_health after ExecuteHamB(Ham_CS_RoundRespawn, id) and putting a model for cs_set_user_team still the same problem, someone tell me how I sort this out :/..


PHP Code:

/* Plugin generated by AMXX-Studio */
 
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
 
#define PLUGIN "Fair Teams"
#define VERSION "1.0"
#define AUTHOR "Len"
 
 
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("jointeam""block_jointeam")
}
 
public 
block_jointeam(id) {
    new 
team[2]
    
read_argv(1team1)
    if (
access(idADMIN_IMMUNITY)) {
        if (
team[0] == '1'cs_set_user_team(idCS_TEAM_T)
        if (
team[0] == '2'cs_set_user_team(idCS_TEAM_CT)
        goto 
SPAWN_PLAYER
    
}
 
    if (
CS_TEAM_UNASSIGNED cs_get_user_team(id) < CS_TEAM_SPECTATOR) return PLUGIN_HANDLED
 
    
if (team[0] == '3') {
        
cs_set_user_team(id,CS_TEAM_SPECTATOR)
        return 
PLUGIN_HANDLED
    
}
 
    new 
iteam_balance[3], max_players
    team_balance
[team[0]] = 1
    max_players 
get_maxplayers()
 
    for (
1<= max_playersi++) {
        if (
cs_get_user_team(id) == CS_TEAM_Tteam_balance[0]++
        else if (
cs_get_user_team(id) == CS_TEAM_Tteam_balance[1]++
    }
 
    
team_balance[2] = team_balance[0] - team_balance[1]
 
    if ((
team_balance[2] < -1) || (team_balance[2] > 1)) {
        if (
team_balance[1] > team_balance[1]) cs_set_user_team(idCS_TEAM_T)
        else if (
team_balance[0] > team_balance[1]) cs_set_user_team(idCS_TEAM_CT)
        goto 
SPAWN_PLAYER
    
}
 
    if ((
team[0] == '1') && (cs_get_user_team(id) != CS_TEAM_T)) cs_set_user_team(idCS_TEAM_T)
    else if ((
team[0] == '2') && (cs_get_user_team(id) != CS_TEAM_CT)) cs_set_user_team(idCS_TEAM_CT)
 
    
SPAWN_PLAYER:
 
    
ExecuteHamB(Ham_CS_RoundRespawnid)
    return 
PLUGIN_HANDLED



Len 01-05-2011 11:30

Re: Wierd respawn
 
Come on I'm new to pawn and amxmodx, this script I have made compiles fine and works, just the spawning is crap... buggy death effect, no visable health, round time or armor.

I'm sorry for bumping but I want a answer, I don't know why people haven't replied I also tried IRC but no one is active..

drekes 01-05-2011 11:52

Re: Wierd respawn
 
PHP Code:

/* Plugin generated by AMXX-Studio */
 
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
 
#define PLUGIN "Fair Teams"
#define VERSION "1.0"
#define AUTHOR "Len"
 
 
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("jointeam""block_jointeam")
}
 
public 
block_jointeam(id) {
    new 
team[2]
    
read_argv(1team1)
    if (
access(idADMIN_IMMUNITY)) {
        if (
team[0] == '1'cs_set_user_team(idCS_TEAM_T)
        if (
team[0] == '2'cs_set_user_team(idCS_TEAM_CT)
        
SPAWN_PLAYER(id);
    }
 
    if (
CS_TEAM_UNASSIGNED cs_get_user_team(id) < CS_TEAM_SPECTATOR) return PLUGIN_HANDLED
 
    
if (team[0] == '3') {
        
cs_set_user_team(id,CS_TEAM_SPECTATOR)
        return 
PLUGIN_HANDLED
    
}
 
    new 
iteam_balance[3], max_players
    team_balance
[team[0]] = 1
    max_players 
get_maxplayers()
 
    for (
1<= max_playersi++) {
        if (
cs_get_user_team(id) == CS_TEAM_Tteam_balance[0]++
        else if (
cs_get_user_team(id) == CS_TEAM_Tteam_balance[1]++
    }
 
    
team_balance[2] = team_balance[0] - team_balance[1]
 
    if ((
team_balance[2] < -1) || (team_balance[2] > 1)) {
        if (
team_balance[1] > team_balance[1]) cs_set_user_team(idCS_TEAM_T)
        else if (
team_balance[0] > team_balance[1]) cs_set_user_team(idCS_TEAM_CT)
    }
 
    if ((
team[0] == '1') && (cs_get_user_team(id) != CS_TEAM_T)) cs_set_user_team(idCS_TEAM_T)
    else if ((
team[0] == '2') && (cs_get_user_team(id) != CS_TEAM_CT)) cs_set_user_team(idCS_TEAM_CT)
 
    return 
PLUGIN_HANDLED
}  

SPAWN_PLAYER(id)
    
ExecuteHamB(Ham_CS_RoundRespawnid); 


Len 01-05-2011 11:56

Re: Wierd respawn
 
im looking for a explanation drekes
edit: and does that make a custom function and what is the meaning of ;? I'm guessing it means PLUGIN_HANDLED?
Quote:

SPAWN_PLAYER(id)
ExecuteHamB(Ham_CS_RoundRespawn, id);

Elusive138 01-05-2011 13:00

Re: Wierd respawn
 
Quote:

Originally Posted by Len (Post 1386619)
im looking for a explanation drekes
edit: and does that make a custom function and what is the meaning of ;? I'm guessing it means PLUGIN_HANDLED?

; = end of line

Quote:

Originally Posted by http://www.compuphase.com/pawn/pawnfeatures.htm
In pawn, semicolons to end a line are optional. It is common practice to write no more than one instruction per line, but if one does, he or she must still use the semicolon to separate two instructions on a line.

PLUGIN_HANDLED is a return value (I think it was defined as 1).


Just from a quick look drekes has replaced your label with a function and your gotos with calling the function... but seems to have forgotten to add a return afterwards? Anyway, wouldn't it be easier to just replace the gotos with
PHP Code:

ExecuteHamB(Ham_CS_RoundRespawnid)
return 
PLUGIN_HANDLED 

It's a single line function with no other purpose, with what drekes did :|

EDIT: Also, the spawn after
PHP Code:

else if (team_balance[0] > team_balance[1]) cs_set_user_team(idCS_TEAM_CT

was taken out... I'm too tired to think about why :|

Len 01-05-2011 13:38

Re: Wierd respawn
 
with that in mind, it has to of been the goto and thanks for the help elusive


All times are GMT -4. The time now is 02:09.

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