Raised This Month: $ Target: $400
 0% 

Respawn Chance (bug/help)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eliptics
Junior Member
Join Date: Mar 2010
Old 10-30-2011 , 13:25   Respawn Chance (bug/help)
Reply With Quote #1

i found a bug on this plugin. you can say reviveme and if it didnt succeed you can reconnect and try again and so on.. please someone fix it ...
Thanks!

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
new Float:LastSpawnAttempt[33]
new 
bool:RoundEnded false
public plugin_init()

 
register_plugin("Random Respawn Chance""0.9""Bo0m!")
 
register_clcmd("say""spawnchance")
 
register_cvar("spawnchance_on","1")
 
register_cvar("spawnchance_msg","1")
 
register_cvar("spawnchance_msgtime","75"
 
register_cvar("spawnchance_odds","10")
 
register_cvar("spawnchance_wait","150")
 
register_cvar("spawnchance_adminbonus","0")
 
register_logevent("event_RoundStarted"2"1=Round_Start")
 
register_logevent("event_RoundEnded"2"1=Round_End")
}
public 
plugin_precache()
{
 
precache_sound("debris/beamstart9.wav")
}
public 
client_putinserver(id)
{
 if(
is_user_bot(id)) 
  return 
PLUGIN_HANDLED
 set_task
(20.0"spawnmessage"id)
 
LastSpawnAttempt[id] = -5000.0
 
return PLUGIN_CONTINUE
}
public 
client_disconnect(id)
{
 if(
is_user_bot(id)) 
  return 
PLUGIN_HANDLED
 LastSpawnAttempt
[id] = -5000.0
 
return PLUGIN_CONTINUE
}
public 
event_RoundStarted()
{
 
RoundEnded false
}
public 
event_RoundEnded()
{
 
RoundEnded true
}
public 
spawnagain(id)
{
 
spawn(id)
 
give_item(id,"weapon_knife")
 return 
PLUGIN_CONTINUE
}
public 
spawnmessage(id)
{
 if (!
get_cvar_num("spawnchance_on") || !get_cvar_num("spawnchance_msg"))
 return 
PLUGIN_HANDLED
 
if(get_cvar_num("spawnchance_msgtime") < 10)
 {
  
server_cmd ("spawnchance_msgtime 10")
  return 
PLUGIN_CONTINUE
 
}
 if(
is_user_connected(id)) client_print(idprint_chat"[Respawn Chance] You have a 1 in %d chance to revive when dead! Say reviveme for your chance!",get_cvar_num("spawnchance_odds"))
 
set_task(get_cvar_float("spawnchance_msgtime"), "spawnmessage"id)
 return 
PLUGIN_HANDLED
}
public 
spawnchance(id)
{
 new 
Speech[192]
 
read_args(Speech,192)
 
remove_quotes(Speech)
 if(
get_cvar_num("spawnchance_odds") < 2)
 {
  
server_cmd ("spawnchance_odds 2")
  return 
PLUGIN_CONTINUE
 
}
 if(
get_cvar_num("spawnchance_odds") > 1000)
 {
  
server_cmd ("spawnchance_odds 1000")
  return 
PLUGIN_CONTINUE
 
}
 if(
get_cvar_num("spawnchance_wait") < 0)
 {
  
server_cmd ("spawnchance_wait 0")
  return 
PLUGIN_CONTINUE
 
}
 if(
get_cvar_num("spawnchance_wait") > 5000)
 {
  
server_cmd ("spawnchance_wait 5000")
  return 
PLUGIN_CONTINUE
 
}
 if(
spawnchance2(id,Speech)) 
 return 
PLUGIN_HANDLED
 
return PLUGIN_CONTINUE
}
public 
spawnchance2(id,Speech[])
{
 if (
get_cvar_num("spawnchance_adminbonus") == && (get_user_flags(id) & ADMIN_IMMUNITY) )
 {
  
LastSpawnAttempt[id] = -5000.0
 
}
 if ( (
equali(Speech"respawnme")) || (equali(Speech"reviveme")) || (equali(Speech"revive me")) || (equali(Speech"/revive")) || (equali(Speech"/reviveme")) || (equali(Speech"respawn me")) )
 {
  if (
get_cvar_num("spawnchance_on") == 0)
  {
   
client_print(idprint_chat"Respawning is currently disabled.")
   return 
PLUGIN_HANDLED
  
}
  if (
cs_get_user_team(id) == CS_TEAM_SPECTATOR)
  {
   
client_print(idprint_chat"Spectators can't respawn silly!.")
   return 
PLUGIN_HANDLED
  
}
  if (
RoundEnded == true)
  {
   
client_print(idprint_chat"The round ended, you don't want to waste your chance!.")
   return 
PLUGIN_HANDLED
  
}
  if (
is_user_alive(id) == 1)
  {
   
client_print(id,print_chat"You have to be dead before you can attempt to respawn!")
   return 
PLUGIN_HANDLED
  
}
  else if (
get_gametime() < LastSpawnAttempt[id] + get_cvar_float("spawnchance_wait"))
  {
   
client_print(id,print_chat"Sorry you can't try to respawn now. Try again in %d seconds.",floatround(LastSpawnAttempt[id] + get_cvar_num("spawnchance_wait") - get_gametime() + 1))
   return 
PLUGIN_HANDLED
  
}
  new 
ChanceAmount random(get_cvar_num("spawnchance_odds"))
  new 
User[32]
  
get_user_name(id,User,32)
 
  if (
get_cvar_num("spawnchance_adminbonus") == && (get_user_flags(id) & ADMIN_IMMUNITY) )
  {
   
client_cmd(id,"spk debris/beamstart9")
   
client_print(id,print_chat"You win! Prepare to be respawned!")
   
spawn(id)
   
set_task(0.5,"spawnagain",id)
   
set_hudmessage(200,0,0, -1.00.3006.06.00.50.151)
       
show_hudmessage(0,"%s won and has been respawned!",User)
  }
  else
  {
   if (
== ChanceAmount)
   {
    
client_cmd(id,"spk debris/beamstart9")
    
client_print(id,print_chat"You win! Prepare to be respawned!")
    
spawn(id)
    
set_task(0.5,"spawnagain",id)
    
set_hudmessage(200,0,0, -1.00.3006.06.00.50.151)
        
show_hudmessage(0,"%s won and has been respawned!",User)
   }
   else if (
ChanceAmount 1)
   {
    
client_print(id,print_chat"Sorry, you didn't respawn this time!")
   }
   
LastSpawnAttempt[id] = get_gametime()
   return 
PLUGIN_CONTINUE
  
}
  return 
PLUGIN_CONTINUE
 
}
 return 
PLUGIN_CONTINUE

PLUGIN LINK
I dont understand nothing about coding but i think it is like this:
code...

//If a player reconnect show a message like that:
client_print(id,print_chat, "You cannot use reviveme because you reconnected!"

Last edited by eliptics; 11-13-2011 at 15:41.
eliptics is offline
Old 11-01-2011, 14:36
eliptics
This message has been deleted by Arkshine. Reason: Don't bump until 15 days have passed.
Jenkins
AlliedModders Donor
Join Date: Jul 2011
Old 11-03-2011 , 07:22   Re: Respawn Chance (bug/help)
Reply With Quote #2

or you just add another plugin that doesnt allow reconnecting/retrying?
Jenkins is offline
sake
Senior Member
Join Date: Jul 2011
Old 11-03-2011 , 16:38   Re: Respawn Chance (bug/help)
Reply With Quote #3

Try to create a variable that holds information about if the player has already died this round or if he has ever died (I don't know the plugin and I don't know if the second version works, but it can be a clue).
__________________
sake is offline
eliptics
Junior Member
Join Date: Mar 2010
Old 11-03-2011 , 17:14   Re: Respawn Chance (bug/help)
Reply With Quote #4

Quote:
Originally Posted by sake View Post
Try to create a variable that holds information about if the player has already died this round or if he has ever died (I don't know the plugin and I don't know if the second version works, but it can be a clue).
THX, LOL but i dont understand nothing about coding.. but i think u are right
Can you do it?

Last edited by eliptics; 11-03-2011 at 17:19.
eliptics is offline
quark
Veteran Member
Join Date: Oct 2011
Location: Your mind.
Old 11-03-2011 , 18:32   Re: Respawn Chance (bug/help)
Reply With Quote #5

Quote:
Originally Posted by Jenkins View Post
or you just add another plugin that doesnt allow reconnecting/retrying?
__________________

Check out My Plugins:
qServerInfo ; ASKTAG
quark is offline
eliptics
Junior Member
Join Date: Mar 2010
Old 11-13-2011 , 15:43   Re: Respawn Chance (bug/help)
Reply With Quote #6

Someone can help me?
eliptics is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 11-13-2011 , 18:48   Re: Respawn Chance (bug/help)
Reply With Quote #7

Quote:
Originally Posted by eliptics View Post
Someone can help me?
If you don't know how to script, then you should be in Suggestions/Requests.
__________________
Hi.
Kreation is offline
Dark Style
BANNED
Join Date: Feb 2011
Location: Brazil
Old 11-14-2011 , 09:38   Re: Respawn Chance (bug/help)
Reply With Quote #8

Quote:
Originally Posted by Kreation View Post
If you don't know how to script, then you should be in Suggestions/Requests.
Dark Style 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 21:14.


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