Raised This Month: $ Target: $400
 0% 

Setting movement speed depending on class [Day of Defeat]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tabu34
New Member
Join Date: Jul 2007
Old 07-05-2007 , 21:17   Setting movement speed depending on class [Day of Defeat]
Reply With Quote #1

I'm trying to write a plugin that makes the movement speed of certain classes slower or faster. I have three warnings that I would like to resolve before I move on with the plugin.

Code:
\movespeed.sma<20> : warning 213: tag mismatch
\movespeed.sma<25> : warning 213: tag mismatch
\movespeed.sma<29> : warning 209: function "dod_client_spawn" should return a value
The plugin code is this:

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

new PLUGIN[] = "DoD Movement Speed"
new AUTHOR[] = "Tabu34"
new VERSION[]= "1.00"

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
}

public dod_client_spawn(id)
{
    new class = dod_get_user_class(id)
    if(class == 2||class == 3||class == 4||class == 12)
    {
        set_user_maxspeed(id, 650)
        return PLUGIN_HANDLED
    }else{
    if(class == 6||class == 7||class == 8||class == 13||class == 15||class == 17||class == 18)
    {
        set_user_maxspeed(id, 550)
        return PLUGIN_HANDLED
    }
}
}
I'm sorry if this is only a simple mistake, I am new to writing AMX plugins.
Thank you in advance for the help.

Last edited by Tabu34; 07-05-2007 at 22:41.
Tabu34 is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 07-06-2007 , 00:42   Re: Setting movement speed depending on class [Day of Defeat]
Reply With Quote #2

Code:
public dod_client_spawn(id)
{
    new class = dod_get_user_class(id)
    if(class == 2||class == 3||class == 4||class == 12)
    {
        set_user_maxspeed(id, 650.0)
        return PLUGIN_HANDLED
    }else if(class == 6||class == 7||class == 8||class == 13||class == 15||class == 17||class == 18)
    {
        set_user_maxspeed(id, 550.0)
        return PLUGIN_HANDLED
    }
    return PLUGIN_HANDLED
}
that should get rid of the warnings. don't know if that will work though. gl.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
kmal2t
BANNED
Join Date: Apr 2006
Old 07-06-2007 , 01:57   Re: Setting movement speed depending on class [Day of Defeat]
Reply With Quote #3

Float: set_user_maxspeed ( index, [ Float:speed = - 1.0 ] )

Also you should probably use a little neater indenting so you don't have stacked branches that confuse yourself and give you errors. Use the amxmodx studio which has an auto indenter

Last edited by kmal2t; 07-06-2007 at 02:00.
kmal2t 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:32.


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