AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Setting movement speed depending on class [Day of Defeat] (https://forums.alliedmods.net/showthread.php?t=57504)

Tabu34 07-05-2007 21:17

Setting movement speed depending on class [Day of Defeat]
 
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.

Emp` 07-06-2007 00:42

Re: Setting movement speed depending on class [Day of Defeat]
 
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.

kmal2t 07-06-2007 01:57

Re: Setting movement speed depending on class [Day of Defeat]
 
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


All times are GMT -4. The time now is 21:32.

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