Raised This Month: $ Target: $400
 0% 

My script doesnt work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
josepi
New Member
Join Date: Jul 2006
Old 07-28-2008 , 20:16   My script doesnt work
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>

new Float:g_Speed

public plugin_init() 
{
register_plugin("Speed Configurator","1.0","HeAd")
register_event("ResetHUD""Event""be")
g_Speed register_cvar("amx_playerspeed","-1.0")
return 
PLUGIN_CONTINUE 
}

public 
Event(id)
{  
if(
g_Speed <= 0){
g_Speed = -1.0
}
set_task(3.0"Speed"id)
return 
PLUGIN_CONTINUE
}


public 
Speed(id){
new 
Float:speed g_Speed 
set_user_maxspeed(id speed); 
client_print(id,print_chat,"[SERVER] La velocidad del jugador es de %d",speed)
return 
PLUGIN_HANDLED


I want is to change player speed , and every round player speed should be changed with the speed saved on cvar.
josepi is offline
PvtSmithFSSF
Senior Member
Join Date: Jul 2008
Old 07-28-2008 , 22:33   Re: My script doesnt work
Reply With Quote #2

Unfortunately with cs, speed is tricky. Each time you switch weapons speed is reset
PvtSmithFSSF is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 07-29-2008 , 00:36   Re: My script doesnt work
Reply With Quote #3

Well I have to point out that there are a lot of errors in your script.
I will write the script for you when you have understood what I've said.

PHP Code:
new Float:g_speed
g_speed 
register_cvar("<name>","<value>"
This means that g_speed becoms the cvar pointer of the cvar <name>
And in this situation g_speed isn't a float value, its an integer value.
It can have the value 10 , 540 , 3214. Depending on how many cvars your server has, so the way you have done it doesn't make sense.

So we change it to:
PHP Code:
new g_speed_cvar
g_speed_cvar 
register_cvar("name","value"
To change the speed player all the time it is best to use prethink
PHP Code:
register_forward(FM_PlayerPreThink,"function"// in plugin_init

public function(id)
{
if (!
is_user_alive(id))
return 
FMRES_IGNORED
set_user_maxspeed
(id,get_pcvar_num(g_speed_cvar))

return 
FMRES_IGNORED

__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Reply


Thread Tools
Display Modes

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 05:31.


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