Raised This Month: $ Target: $400
 0% 

How to spawn a player at start?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Guenhwyvar
AMX Mod X Beta Tester
Join Date: Jul 2005
Location: Berlin / Germany
Old 07-20-2006 , 04:38   How to spawn a player at start?
Reply With Quote #1

On my kreedz server, I want to implement a function "say /start" to let players beam back to start.

If I use the following, the player spawns on the last checkpoint he saved.

Quote:
spawn(id);
set_task(0.5,"spawnagain",id);

public spawnagain(id) {
spawn(id);
}
How can I force a spawn in the originally spawn area?
Guenhwyvar is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 07-20-2006 , 05:49   Re: How to spawn a player at start?
Reply With Quote #2

Code:
register_clcmd("say /start", "cmdStart"); in plugin_init() public cmdStart(id) {      spawn(id); }

This should work unless that plugin you are using hook resethud to detect when you respawn and teleport you back to your last location.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Guenhwyvar
AMX Mod X Beta Tester
Join Date: Jul 2005
Location: Berlin / Germany
Old 07-20-2006 , 06:03   Re: How to spawn a player at start?
Reply With Quote #3

The plugin (kz_multiplugin) apparently does exactly this. But there must be another way to get the player to the start.

Code:
public ResetHUD(id) {     //Check if Checkpoints are on...     if (get_cvar_num("kz_checkpoints") != 0) {         //Check if user has a Checkpoint         if (gCheckpoint[id]) {             //Yep he has one... Move him to it...             if (CheckCheckpoint(id)) move_to_check(id)             cs_set_user_money(id,0)             //Check if limited Checkpointuse is on             if (get_cvar_num("kz_limitedcp") != 0) {                 //Yep.. It is on... Delete Checkpoint                 gCheckpoint[id]=false                 client_print(id,print_chat,"[KZ] Checkpoint Used...")             }         }else{             if (gHasTimer[id]) ResetTimer(id,1)         }     }else{         if (gHasTimer[id]) ResetTimer(id,1)     }     //Chech if he just joined     if (gJoined[id]) {         get_user_origin(id,gLastCheckpointPos[id])         gJoined[id]=false         if (get_cvar_num("kz_checkpoints")==1) {             client_print(id,print_chat,"* ^"KZ Multiplugin^" is enabled")             client_print(id,print_chat,"* Use checkpoints by typing ^"checkpoint^" & ^"gocheck^" in console")             client_print(id,print_chat,"* if you get stuck say ^"/stuck^" to jump back to last checkpoint")         }else{             client_print(id,print_chat,"* ^"KZ Multiplugin^" is disabled")         }     }     //Check if he gets godmode     if (get_cvar_num("kz_godmode") != 0) {         //Yep, it's on... Give it too him...         set_user_godmode(id,1)     }     //Check if auto scout give is on...     if (get_cvar_num("kz_scout") != 0) {         //Yep, it's on... Give it too him...         GiveScout(id)     }     //Check if he gets semiclip...     if (get_cvar_num("kz_semiclip") != 0) {         //Yep, it's on... Give it too him...         entity_set_int(id, EV_INT_solid, SOLID_TRIGGER)     }else{         //Nope, it's off... Make sure he has clip         entity_set_int(id, EV_INT_solid, SOLID_BBOX)     }     //Check if nightmode is on...     if (get_cvar_num("kz_nightmode") != 0) {         //Yep, it's on...         set_lights("a")     }else{         //Nope, it's off...         set_lights("n")     }     //Check if he is hooked to something     if (gIsHooked[id]) RopeRelease(id)     cs_set_user_money(id,gMoney[id]) }
Guenhwyvar is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 07-20-2006 , 15:14   Re: How to spawn a player at start?
Reply With Quote #4

Code:
new bool:spawn[33]; // at the very top register_clcmd("say /start", "cmdStart"); // in plugin_init() public cmdStart(id) {     spawn[id] = true;     spawn(id); } public ResetHUD(id) {         //Check if Checkpoints are on...         if (get_cvar_num("kz_checkpoints") != 0)     {                 //Check if user has a Checkpoint                 if (gCheckpoint[id] && !spawn[id])         {                         //Yep he has one... Move him to it...                         if (CheckCheckpoint(id)) move_to_check(id)             cs_set_user_money(id,0)             //Check if limited Checkpointuse is on                         if (get_cvar_num("kz_limitedcp") != 0)             {                                 //Yep.. It is on... Delete Checkpoint                                 gCheckpoint[id]=false                                 client_print(id,print_chat,"[KZ] Checkpoint Used...")                         }                 }else{                         if (gHasTimer[id]) ResetTimer(id,1)                 }         }else{                 if (gHasTimer[id]) ResetTimer(id,1)         }     spawn[id] = false;

Something like this will work. I have been writing a plugin you might want to beta for me. I'll PM you some info.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Marticus
Member
Join Date: Nov 2004
Old 07-29-2006 , 10:03   Re: How to spawn a player at start?
Reply With Quote #5

You are going to confuse people with that ResetHUD function name
__________________
"Sell not virtue to purchase wealth, nor Liberty to purchase power." -Ben Franklin 1706-1790
Marticus is offline
Des12
Senior Member
Join Date: Jan 2005
Old 07-29-2006 , 15:30   Re: How to spawn a player at start?
Reply With Quote #6

Don't you need to register an event for the public ResetHUD to work?
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 07-29-2006 , 15:37   Re: How to spawn a player at start?
Reply With Quote #7

@ Des12
yea, but this was just a partial code for pl2003 so change his current code.

@ Marticus

If other people are going to get confused GG.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Marticus
Member
Join Date: Nov 2004
Old 07-29-2006 , 15:40   Re: How to spawn a player at start?
Reply With Quote #8

Nevermind, I didn't realise you were making the function for the event by the same name. That happens when you're on 4 hours of sleep.
__________________
"Sell not virtue to purchase wealth, nor Liberty to purchase power." -Ben Franklin 1706-1790

Last edited by Marticus; 07-29-2006 at 15:47.
Marticus is offline
Old 07-29-2006, 15:46
Marticus
This message has been deleted by Marticus. Reason: because it's a duplicate
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 00:43.


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