Raised This Month: $ Target: $400
 0% 

Respawn Chance (bug/help)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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:24.


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