Raised This Month: $ Target: $400
 0% 

need help :) :) :)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sp@jk
Member
Join Date: May 2010
Location: Serbia
Old 02-09-2011 , 13:05   need help :) :) :)
Reply With Quote #1

I need a plugin that will set all players to Terroris team and select one random player to be a ct on round start. And it must first select player fot ct becouse if it first transfer them to terrorist team and then sleset a random player and transfer it to ct, it will be a round draw

Most of people won't understand!

Sorry for ban English
Sp@jk is offline
Old 02-10-2011, 13:03
Sp@jk
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 02-10-2011 , 14:07   Re: need help :) :) :)
Reply With Quote #2

Incorrect thread.
Post here, or wait for a moderator to move at the right place.
http://forums.alliedmods.net/forumdisplay.php?f=12
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Sp@jk
Member
Join Date: May 2010
Location: Serbia
Old 02-10-2011 , 15:35   Re: need help :) :) :)
Reply With Quote #3

actually, I don't need a plugin, I just need source to insert it in my mod
Sp@jk is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-10-2011 , 19:54   Re: need help :) :) :)
Reply With Quote #4

get_players() + random() + set_user_team() Done.
__________________
fysiks is offline
Lulu the hero
Senior Member
Join Date: Oct 2009
Location: Budapest, Hungary
Old 02-10-2011 , 21:02   Re: need help :) :) :)
Reply With Quote #5

Quote:
Originally Posted by Sp@jk View Post
... I just need source to insert it in my mod
First of all, you are not making a mod. You are making a PLUGIN.
Second, if you want to create the plugin, and only need some advices or hints, then it's a "scripting help" topic. Else it is indeed a plugin request. Doesn't metter how small is the code you need.

PHP Code:
#include <cstrike>

// Store all the CT models in an array to choose from it later
new const CsInternalModel:CT_MODELS[] =
{
    
CS_CT_GIGN,
    
CS_CT_GSG9,
    
CS_CT_SAS,
    
CS_CT_URBAN
}

// Same goes with the T models
new const CsInternalModel:T_MODELS[]=
{
    
CS_T_ARCTIC,
    
CS_T_GUERILLA,
    
CS_T_LEET,
    
CS_T_TERROR
}

// Call this at round start, or end, or whereever you need to set teams
public set_teams()
{
    
// A container for the player id-s, get_players gonna fill this up
    
static players[32];
    
// A variable which will hold the size of players, and a loop counter
    
new playernumi;
    
// A variable to store the choosen ct's index( pointing into the players array )
    
new ct_id;
    
    
// Get all the players on map, also skip hltv
    
get_players(playersplayernum"h");
    
    
// Choose a random player from 0 to playernum-1
    
ct_id random(playernum);
    
// Set that player to team CT, plus set a random CT model
    
cs_set_user_team(players[ct_id], CS_TEAM_CTCT_MODELS[random(sizeof CT_MODELS)]);
    
    
// Go through all the players
    
for(0playernumi++)
    {
        
// If it is our choosen CT, then skip
        
if(== ct_id) continue;
        
// Else set the player's team to T, also set a random T model
        
cs_set_user_team(players[i], CS_TEAM_TT_MODELS[random(sizeof T_MODELS)]);
    }
    
    
// Return the ID of the new CT - this line is not important, you can delete it if you want.
    
return player[ct_id];


Last edited by Lulu the hero; 02-10-2011 at 21:15.
Lulu the hero is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-10-2011 , 22:40   Re: need help :) :) :)
Reply With Quote #6

Quote:
Originally Posted by ot_207 View Post
Incorrect thread.
Post here, or wait for a moderator to move at the right place.
http://forums.alliedmods.net/forumdisplay.php?f=12
Don't bump until 2 weeks have passed since the last post in the topic.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 02-11-2011 , 06:08   Re: need help :) :) :)
Reply With Quote #7

@Lulu the hero, this will work?

PHP Code:
#include <amxmodx>
#include <cstrike>

public plugin_init() 
{
    
register_plugin"rCT to T""200.0""amxmodx.org")
    
    
register_event("HLTV""NewRound""a""1=0""2=0")
}
public 
NewRound()
{
    new 
Tplayers[32], tnumname[32], id
    get_players
Tplayerstnum"e""TERRORIST" )

    
id Tplayersrandomtnum ) ]
    
cs_set_user_teamidCS_TEAM_CT )
    
    
get_user_nameidnamecharsmax(name) )
    
client_printidprint_chat,"[Jurka] Random TR is: %s, he is transfered to CT."name )

JocAnis is offline
Lulu the hero
Senior Member
Join Date: Oct 2009
Location: Budapest, Hungary
Old 02-11-2011 , 10:35   Re: need help :) :) :)
Reply With Quote #8

In your code, you only search the terrorists. You don't deal with the CTs. There will be more and more cts at every round.
Lulu the hero 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 14:23.


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