AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   a little help with a error (https://forums.alliedmods.net/showthread.php?t=53828)

CipryXXX 04-11-2007 15:14

a little help with a error
 
hy all,i am new on this forum and just learning some things:) . i am tryng to make myselef a plugin that addes extra life,armour,speed,gravity ,but when i try to compile this code i get the next error:
/home/groups/amxmodx/tmp3/php14L84z.sma(21) : error 035: argument type mismatch (argument 2)
here is my code :
Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "CipryXXX`s Fun plugin"
#define VERSION "1.0"
#define AUTHOR "CipryXXX"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say /menu","Meniu")
}
public Meniu(id)
{
    new menu
    menu = register_menu ("CipryXXX`s Fun plugin","Meniu2")
    menu_additem(menu,"\wLife - 4000$(addes 150HP)","1",0)
    menu_additem(menu,"\wArmour - 2000$(addes 150 armour)","2",0)
    menu_additem(menu,"\wSpeed - 3000$(addes extra speed)","3",0)
    menu_additem(menu,"\wGravity - 2000$(addes extra gravity)","4",0)   
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
    menu_display(id,menu,0)
}
public Meniu2(id,menu,item)
{
    if (item == MENU_EXIT)
    {
        menu_destroy(menu)
        return PLUGIN_HANDLED
    }
    else
    {
        if (!is_user_alive(id))
        {
            client_print(id, print_center, "U are dead and u can not access the menu.")
        }
        else
        {
            new buton[100],nume[100]
            new access, callback
            menu_item_getinfo(menu,item,access,buton,99,nume,99,callback)
            new tasta
            tasta = str_to_num(buton)
            switch (tasta)
            {
                case 1: life(id)
                case 2: armour(id)
                case 3: speed(id)
                case 4: gravity(id)
            }
        }
    }
    menu_destroy(menu)
    return PLUGIN_HANDLED
}
public life(id)
{
    if ( cs_get_user_money(id)<= 4000)
    {
        client_print(id, print_center, "U dont have enough money to buy extra life")
    }
    else
    {
        cs_set_user_money(id,cs_get_user_money(id)-4000)
        set_user_health(id,get_user_health(id)+150)
    }
}
public armour(id)
{
    if ( cs_get_user_money(id)<= 2000)
    {
        client_print(id, print_center, "U dont have enough money to buy extra armour")
    }
    else
    {
        cs_set_user_money(id,cs_get_user_money(id)-2000)
        set_user_armor(id,get_user_armor(id)+150)
    }
}
public speed(id)
{
    if ( cs_get_user_money(id)<= 3000)
    {
        client_print(id, print_center, "U dont have enough money to buy extra speed")
    }
    else
    {
        cs_set_user_money(id,cs_get_user_money(id)-3000)
        set_user_maxspeed(id,0.0)
    }
}
public gravity(id)
{
    if ( cs_get_user_money(id)<= 2000)
    {
        client_print(id, print_center, "U dont have enough money to buy extra gravity")
    }
    else
    {
        cs_set_user_money(id,cs_get_user_money(id)-2000)
        set_user_gravity(id,0.5)
    }
}


teame06 04-11-2007 17:09

Re: a little help with a error
 
Your mismatching menu code.

Code:
menu = register_menu ("CipryXXX`s Fun plugin","Meniu2")

when your suppose to use menu_create

CipryXXX 04-12-2007 05:39

Re: a little help with a error
 
works now but i got a problem , when i chose speed and change my weapon my speed is normal again so i did this:
Code:

public speed(id)
{
    if ( cs_get_user_money(id)< 3000)
    {
        client_print(id, print_center, "U dont have enough money to buy extra speed")
    }
    else
    {
        cs_set_user_money(id,cs_get_user_money(id)-3000)
        set_user_maxspeed(id, 0.0)
        new clip,ammo
        if (get_user_weapon ( id, clip, ammo ) != CSW_KNIFE)
        {
            set_user_maxspeed(id, 0.0)
        }
        else
        {
            set_user_maxspeed(id, 0.0)
        }
    }
}

but still doesent work...changes to normal speed if i change my weapon

teame06 04-12-2007 13:57

Re: a little help with a error
 
Quote:

Originally Posted by CipryXXX (Post 463830)
works now but i got a problem , when i chose speed and change my weapon my speed is normal again so i did this:

//code ...

but still doesent work...changes to normal speed if i change my weapon

Your going to have to hook CurWeapon and set your speed back again when they change to another weapon. Because speed are reseted when they change to another weapon.

regalis 04-12-2007 14:34

Re: a little help with a error
 
2 Attachment(s)
Hi, maybe take a look at my plugin..there is a solution for your problem ;)
http://forums.alliedmods.net/showthread.php?t=53603

greetz regalis

Hi bmann,
here is the new version of amx_super and unlimited Ammo... ;)

CipryXXX 04-12-2007 16:28

Re: a little help with a error
 
here is what i mayd...dunno why its not working :),i mayd a new variable : viteza and in my public speed(id) if the user buys spees then viteza =1 and in my public check(id) i am test if the user changes the weapon if viteza=1 but doesent work...some help pls.
Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "CipryXXX`s Fun plugin"
#define VERSION "1.0"
#define AUTHOR "CipryXXX"

new viteza

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say /menu","Meniu")
    register_event("check","check","be")
}
public Meniu(id)
{
    new menu
    menu = menu_create ("\rCipryXXX`s Fun plugin","Meniu2")
    menu_additem(menu,"\wLife - 4000$ (addes 150HP)","1",0)
    menu_additem(menu,"\wArmour - 2000$ (addes 150 armour)","2",0)
    menu_additem(menu,"\wSpeed - 3000$ (addes extra speed)","3",0)
    menu_additem(menu,"\wGravity - 2000$ (addes extra gravity)","4",0)   
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
    menu_display(id,menu,0)
}
public Meniu2(id,menu,item)
{
    if (item == MENU_EXIT)
    {
        menu_destroy(menu)
        return PLUGIN_HANDLED
    }
    else
    {
        if (!is_user_alive(id))
        {
            client_print(id, print_center, "U are dead and u can not access the menu.")
        }
        else
        {
            new buton[100],nume[100]
            new access, callback
            menu_item_getinfo(menu,item,access,buton,99,nume,99,callback)
            new tasta
            tasta = str_to_num(buton)
            switch (tasta)
            {
                case 1: life(id)
                case 2: armour(id)
                case 3: speed(id)
                case 4: gravity(id)
            }
        }
    }
    menu_destroy(menu)
    return PLUGIN_HANDLED
}
public life(id)
{
    if ( cs_get_user_money(id)< 4000)
    {
        client_print(id, print_center, "U dont have enough money to buy extra life")
    }
    else
    {
        cs_set_user_money(id,cs_get_user_money(id)-4000)
        set_user_health(id,get_user_health(id)+150)
    }
}
public armour(id)
{
    if ( cs_get_user_money(id)< 2000)
    {
        client_print(id, print_center, "U dont have enough money to buy extra armour")
    }
    else
    {
        cs_set_user_money(id,cs_get_user_money(id)-2000)
        set_user_armor(id,get_user_armor(id)+150)
    }
}
public speed(id)
{
    if ( cs_get_user_money(id)< 3000)
    {
        client_print(id, print_center, "U dont have enough money to buy extra speed")
    }
    else
    {
        viteza = 1
        cs_set_user_money(id,cs_get_user_money(id)-3000)
        set_user_maxspeed(id, 0.0)
    }
}
public gravity(id)
{
    if ( cs_get_user_money(id)< 2000)
    {
        client_print(id, print_center, "U dont have enough money to buy extra gravity")
    }
    else
    {
        cs_set_user_money(id,cs_get_user_money(id)-2000)
        set_user_gravity(id,0.5)
    }
}
public check(id)
{
    if (viteza == 1)
    {
        set_user_maxspeed(id, 0.0)
        new clip,ammo
        if (get_user_weapon(id,clip,ammo)!=CSW_KNIFE)
        {
            set_user_maxspeed(id, 0.0)
        }
        else
        {
            set_user_maxspeed(id, 0.0)
        }
    }
}


pRED* 04-12-2007 23:18

Re: a little help with a error
 
register the curweapon event like this..

Code:
register_event("CurWeapon", "check", "be","1=1")

Make vietza an array like this..

Code:
new vietza[33]

and then change all the vietza references to..

Code:
vietza[id]

Why in the check function are you checking if the user has a knife and giving them the same speed either way? and why are all the max speeds 0.0?..

CipryXXX 04-13-2007 04:19

Re: a little help with a error
 
works :) ty all


All times are GMT -4. The time now is 06:34.

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