Raised This Month: $ Target: $400
 0% 

Random spawn points?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 01-02-2006 , 17:17   Random spawn points?
Reply With Quote #1

Is there an easy way to make this plugin, spawn players randomly instead of just at main spawns?

Code:
/* AMXX Mod script. * * (c) Copyright 2004, developed by Geesu modified by v3x * This file is provided as is (no warranties). * * Changelog * 1.0: *   Pistols are now given to players when they respawn *   sv_checkpistols cvar added, if this is set to 0, then players will always spawn with a pistol, otherwise they will only spawn with a pistol when it is not scoutzknivez and not a ka map *   sv_respawn cvar added, set this to 0 to disable the plugin */ #include <amxmodx> #include <fun> #include <cstrike> #define DISABLE_CS 0 // team ids #define UNASSIGNED 0 #define TS 1 #define CTS 2 #define AUTO_TEAM 5 #define CVAR_CT_TIME    "sv_respawn_time_ct" #define CVAR_TE_TIME    "sv_respawn_time_te" new bool:g_PistolsDisabled = false public plugin_init(){     register_plugin("Respawn Forever","1.1","Pimp Daddy (OoTOAoO)")     register_event("DeathMsg","on_Death","a")         register_cvar("sv_checkpistols","1")     register_cvar("sv_respawn","1")     register_cvar(CVAR_CT_TIME,"2")     register_cvar(CVAR_TE_TIME,"3")     register_clcmd("say /spawn","ClCmd_Respawn") } public ClCmd_Respawn(id) {     new CsTeams:iTeam = cs_get_user_team(id);         if((iTeam == CS_TEAM_CT || iTeam == CS_TEAM_T) && !is_user_alive(id))     {         new parm[1];         parm[0] = id;         switch(iTeam)         {             case CS_TEAM_CT:             {                 set_task(get_cvar_float(CVAR_CT_TIME) + 0.5,"player_spawn",72,parm,1)                 set_task(get_cvar_float(CVAR_CT_TIME) + 0.7,"player_spawn",72,parm,1)                 set_task(get_cvar_float(CVAR_CT_TIME) + 0.9,"player_giveitems",72,parm,1)             }             case CS_TEAM_T:             {                 set_task(get_cvar_float(CVAR_TE_TIME) + 0.5,"player_spawn",72,parm,1)                 set_task(get_cvar_float(CVAR_TE_TIME) + 0.7,"player_spawn",72,parm,1)                 set_task(get_cvar_float(CVAR_TE_TIME) + 0.9,"player_giveitems",72,parm,1)             }         }     }     return PLUGIN_CONTINUE; } public check_pistols() {         /* Determine if we should give players a pistol or not */     if ( get_cvar_num("sv_checkpistols") )     {         set_task(1.0, "check_pistols")         new mapname[32]         get_mapname(mapname,31)         if ( containi(mapname,"ka_")!=-1 || containi(mapname,"scoutzknivez")!=-1 )                 g_PistolsDisabled = true     } } public on_Death() {     if ( !get_cvar_num("sv_respawn") )         return PLUGIN_CONTINUE         new victim_id = read_data(2)     new parm[1]     parm[0]=victim_id         /* Spawn the player twice to avoid the HL engine bug */     switch(get_user_team(victim_id))     {         case CTS:         {             set_task(get_cvar_float(CVAR_CT_TIME) + 0.5,"player_spawn",72,parm,1)             set_task(get_cvar_float(CVAR_CT_TIME) + 0.7,"player_spawn",72,parm,1)             set_task(get_cvar_float(CVAR_CT_TIME) + 0.9,"player_giveitems",72,parm,1)         }         case TS:         {             set_task(get_cvar_float(CVAR_TE_TIME) + 0.5,"player_spawn",72,parm,1)             set_task(get_cvar_float(CVAR_TE_TIME) + 0.7,"player_spawn",72,parm,1)             set_task(get_cvar_float(CVAR_TE_TIME) + 0.9,"player_giveitems",72,parm,1)         }     }     return PLUGIN_CONTINUE } public player_giveitems(parm[1]) {     new id = parm[0]     give_item(id, "item_suit")     give_item(id, "weapon_knife")     /* Determines if a players should be given a pistol */     if ( !g_PistolsDisabled )     {         new wpnList[32] = 0, number = 0, bool:foundGlock = false, bool:foundUSP = false         get_user_weapons(id,wpnList,number)                 /* Determine if the player already has a pistol */         for (new i = 0;i < number;i++)         {             if (wpnList[i] == CSW_GLOCK18)                 foundGlock = true             if (wpnList[i] == CSW_USP)                 foundUSP = true         }                 /* Give a T his/her pistol */         if ( get_user_team(id)==TS && !foundGlock )         {                 give_item(id,"weapon_glock18")                 give_item(id,"ammo_9mm")                 give_item(id,"ammo_9mm")         }         /* Give a CT his/her pistol */         else if ( get_user_team(id)==CTS && !foundUSP )         {                 give_item(id,"weapon_usp")                 give_item(id,"ammo_45acp")                 give_item(id,"ammo_45acp")         }     }     return PLUGIN_CONTINUE } public player_spawn(parm[1])     spawn(parm[0])
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 01-02-2006 , 20:24  
Reply With Quote #2

Bump.

I'm just looking how to make a few extra spawn points each map, nothing too fancy just a little bit away form spawns.
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 01-02-2006 , 20:27  
Reply With Quote #3

No, You have to have a set of predefined spawn points. You can look at tdm or csdm on how they do it. What they do is have read a config file with a set of origin and another set of view angle. When a player is spawned they use set_user_origin to move them.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 01-02-2006 , 20:31  
Reply With Quote #4

Alright thanks, I'll try to understand that lol.
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
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 15:48.


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