Raised This Month: $ Target: $400
 0% 

Need help finding play spawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
VanillA Ice
Senior Member
Join Date: Apr 2005
Old 07-16-2005 , 16:06   Need help finding play spawn
Reply With Quote #1

Yes i am porting, at request, freecodes teamdeath match...but

since it is from amxx clearly functions work differently so...

i need help find the player spwn...i though about using if statements but i have seen easier ways by using info_player_start but i dk know how to use that....


here is this little peice of code thats the problem...

Code:
public respawnp(parm[]) {    new victim = parm[0]    user_spawn(victim)    set_user_health(victim,get_cvar_num("tdm_health")) }

and for reference here is the entire code...

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fun> new tfrags = 0 new ctfrags = 0 new twins = 0 new ctwins = 0 new tdm = 1 new pcheck = 0 new const c4model[] = "models/w_backpack.mdl" new gmsgStatusText //--------------------------------------------------------------------- /*Messages*/ new ctwin_msg[5][] = {    "Blue Team just 0wn3d Red Team.",    "Blue Team couldnt have done a better job. Red Team..... pitty on you guys.",    "If Blue Team keeps going this way, no one will want to be on Red Team.",    "Blue Team win the match.",    "I knew Blue Team would win. Red Team are a bunch of loosers." } new twin_msg[5][] = {    "Red Team just 0wn3d Blue Team.",    "Red Team couldn't have done a better job. Blue Team..... pitty on you guys.",    "If Red Team keeps going this way, no one will want to be on Blue Team.",    "Red Team win the match.",    "I knew Red Team would win. Blue Team are a bunch of loosers." } new kill_msg[5][] = {    "%s has just added another frag to the Scoreboard.",    "OMG!!! Did you guys see that kill by %s? Great Job.",    "After that kill by %s i think you guys need to worship him.",    "%s has got a kill. WOW!!",    "I knew %s would kill someone." } //--------------------------------------------------------------------- /*Status Text*/ public msg() {    if(tdm == 1)    {       new winfrags = get_cvar_num("tdm_kills")       new Tplayers[32], CTplayers[32], inumT, inumCT       new TiFrags[256]       new CTiFrags[256]       new tnwin = winfrags - tfrags       new ctnwin = winfrags - ctfrags             get_players(Tplayers, inumT, "e", "TERRORIST")       get_players(CTplayers, inumCT, "e", "CT")       format(TiFrags,255,"Team Score: %d  Need To Win: %d   Total Wins: %d",tfrags,tnwin,twins)       format(CTiFrags,255,"Team Score: %d  Need To Win: %d  Total Wins: %d",ctfrags,ctnwin,ctwins)         for(new t=0; t<inumT; t++)       {          message_begin(MSG_ONE, gmsgStatusText, {0,0,0}, Tplayers[t])          write_byte(0)          write_string(TiFrags)          message_end()       }       for(new ct=0; ct<inumCT; ct++)       {          message_begin(MSG_ONE, gmsgStatusText, {0,0,0}, CTplayers[ct])          write_byte(0)          write_string(CTiFrags)          message_end()       }    }    return PLUGIN_HANDLED } //--------------------------------------------------------------------- /*Begin Check*/ public bcheck(id) {    new arg[32]    read_argv(1,arg,31)    if(arg[0] == '1')    {       tdm = 1       set_task(1.0,"msg",1,"",0,"b")       server_cmd("sv_restart 1")       set_cvar_num("mp_freezetime",0)    }    else if(arg[0] == '0')    {       tdm = 0       server_cmd("sv_restart 1")       remove_task(1,0)    }    return PLUGIN_HANDLED } //--------------------------------------------------------------------- /*Check Respawn*/ public respawn() {    if(tdm == 1)    {       //Create new variables that we will use in this function       new winfrags = get_cvar_num("tdm_kills")       new Tplayers[32], CTplayers[32],kname[32],  inumT, inumCT       new ctmsg[128],tmsg[128],kmsg[128]       new killer = read_data(1)       new victim = read_data(2)       new parm[1]       parm[0] = victim       get_user_name(killer,kname,31)             // Get players on both team       get_players(Tplayers, inumT, "e", "TERRORIST")       get_players(CTplayers, inumCT, "e", "CT")           //Format Winning Messages       format(ctmsg,127,ctwin_msg[random_num(0,5)])       format(tmsg,127,twin_msg[random_num(0,5)])       format(kmsg,127,kill_msg[random_num(0,5)],kname)       set_hudmessage(222, 70,0, -1.0, 0.3, 0, 0.0, 6.0, 1.0, 1.0, 2)       msg()              //Add Frag count       if(get_user_team(killer) == get_user_team(victim))       {          show_hudmessage(killer,"Please dont kill your teammates.")       }       else if(get_user_team(killer) != get_user_team(victim))       {          if(get_user_team(killer) == 1)          {             tfrags++             show_hudmessage(0,kmsg)           }          else          {             ctfrags++             show_hudmessage(0,kmsg)          }       }             // Keep respawning if a team hasnt reached winfrags       if(tfrags < winfrags && ctfrags < winfrags )       {          if(pcheck == 0)          {             set_task(0.3,"respawnp", 0, parm, 1)          }       }       // Kill other team when one team reaches winfrags       else if(ctfrags >= winfrags)       {          show_hudmessage(0,ctmsg)          if(pcheck == 0)          {             for ( new tl=0; tl<=inumT; tl++)             {                remove_task(0,0)                user_kill(Tplayers[tl],1)             }          }       }       else if(tfrags >= winfrags)       {          show_hudmessage(0,tmsg)          if(pcheck == 0)          {             for(new ct=0; ct<=inumCT; ct++)             {                remove_task(0,0)                user_kill(CTplayers[ct],1)             }          }       }    }    return PLUGIN_HANDLED } //--------------------------------------------------------------------- /*Respawn*/ public respawnp(parm[]) {    new victim = parm[0]    user_spawn(victim)    set_user_health(victim,get_cvar_num("tdm_health")) } //--------------------------------------------------------------------- /*Check who won*/ public end_round() {    if(tdm == 1)    {       new audio[12]       read_data(2,audio,8)       if (audio[7]=='c')       {          if(pcheck == 0)          {             ctwins+=1             ctfrags = 0             tfrags = 0             emit_sound(0,CHAN_AUTO,"tdm/blue_team_is_the_winner.wav",1.0,ATTN_STATIC, 0, PITCH_HIGH)          }          set_task(7.0,"NewRound",4)       }       else if (audio[7]=='t')       {          if(pcheck == 0)          {             twins+=1             ctfrags = 0             tfrags = 0             emit_sound(0,CHAN_AUTO,"tdm/red_team_is_the_winner.wav",1.0,ATTN_STATIC, 0, PITCH_HIGH)          }          set_task(7.0,"NewRound",4)       }       else          return    } } //--------------------------------------------------------------------- /* Check For Wining Matches*/ public NewRound() {    if(tdm == 1)    {       new nmap[32],players[32],Tplayers[32],CTplayers[32],inum,inumCT,inumT       new ctmsg[128],tmsg[128]       new health = get_cvar_num("tdm_health")       get_cvar_string("amx_nextmap",nmap,31)       new winfrags = get_cvar_num("tdm_kills")       new matches = get_cvar_num("tdm_matches")       set_hudmessage(222, 70,0, -1.0, 0.3, 0, 0.0, 6.0, 1.0, 1.0, 2)       format(ctmsg,127,ctwin_msg[random_num(0,5)])       format(tmsg,127,twin_msg[random_num(0,5)])       get_players(players,inum)       get_players(Tplayers, inumT, "e", "TERRORIST")       get_players(CTplayers, inumCT, "e", "CT")       if(inumCT >= 2 && inumT >= 2)       {          pcheck = 0       }       else       {          pcheck = 1       }       for(new i=0; i<=inum; i++)       {                set_user_health(players[i],health)          if(pcheck == 1)          {             if(ctfrags >= winfrags)             {                show_hudmessage(players[i],ctmsg)                ctfrags = 0                tfrags = 0                ctwins+=1                emit_sound(0,CHAN_AUTO,"tdm/blue_team_is_the_winner.wav",1.0,ATTN_STATIC, 0, PITCH_HIGH)             }             else if(tfrags >= winfrags)             {                show_hudmessage(players[i],tmsg)                ctfrags = 0                tfrags = 0                twins+=1                emit_sound(0,CHAN_AUTO,"tdm/red_team_is_the_winner.wav",1.0,ATTN_STATIC, 0, PITCH_HIGH)             }          }          if(twins >= matches || ctwins >= matches)          {             server_cmd( "changelevel %s", nmap )          }          else if(twins > ctwins)          {             show_hudmessage(players[i],"Red Team has won %d out of %d matches. %d matches left to go.",twins,matches,matches - twins)          }          else if(ctwins > twins)          {             show_hudmessage(players[i],"Blue Team has won %d out of %d matches. %d matches left to go.",ctwins,matches,matches - ctwins)          }          else if(ctwins == twins)          {             show_hudmessage(players[i],"Blue Team and Red Team are tied at %d - %d. %d matches left to go.",ctwins,twins,matches,(matches - ctwins) - twins)          }       }    }    return PLUGIN_HANDLED } //--------------------------------------------------------------------- /*Drop Bomb*/ public dropbomb(id) {    if(tdm == 1)    {       new clip, ammo       new wpn_id=get_user_weapon(id, clip, ammo)       if (wpn_id == CSW_C4 )       {          client_cmd(id,"weapon_c4")          client_cmd(id,"drop")       }    }    return PLUGIN_HANDLED } //--------------------------------------------------------------------- /*Remove Bomb*/ public remove_bomb(id) {     new iEnts = get_global_int(GL_maxEntities)     for( new i = 0; i <= iEnts; i++ )     {         if( !is_valid_ent(i) ) continue         new szModel[64]         entity_get_string(i,EV_SZ_model,szModel,63)         if(containi(szModel,"c4")!=-1)         {             remove_entity(i)             client_print(0,print_chat,"The bomb has been removed!")             break;         }     }    return PLUGIN_HANDLED } //--------------------------------------------------------------------- public plugin_precache() {    precache_sound("tdm/red_team_is_the_winner.wav")    precache_sound("tdm/blue_team_is_the_winner.wav") } //--------------------------------------------------------------------- /*Initilization*/  public plugin_init() {    register_plugin("Team Deathmatch","1.2","Freecode")    register_clcmd("amx_tdm","bcheck",ADMIN_CVAR,"1 = On || 0 = Off")    register_event("DeathMsg","respawn","a")    //register_event("ResetHUD", "NewRound", "a")    register_event("CurWeapon","dropbomb","b")    register_event("SendAudio","end_round","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")    register_cvar("tdm_kills","40")    register_cvar("tdm_matches","5")    register_cvar("tdm_health","100")    set_task(1.0,"remove_bomb", "a")    gmsgStatusText = get_user_msgid("StatusText")  } //---------------------------------------------------------------------
__________________
I can no longer help here......school has started... :/ goodbye everybody :'(
VanillA Ice is offline
Send a message via MSN to VanillA Ice Send a message via Yahoo to VanillA Ice
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 07-16-2005 , 17:05  
Reply With Quote #2

Code:
spawn( victim )
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x 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 12:33.


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