AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   i am doing right? (https://forums.alliedmods.net/showthread.php?t=164532)

ownedin3d 08-12-2011 16:47

i am doing right?
 
ok, so here it is i'm trying to make a say "jump" command instead of buying it from Extra items. ok heres the code. please fix it or help me
Code:

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

/*============================================ ================================*/

new const g_item_cost = 15 // Cost of Multijump

// Say command through which multijump is bought
new const g_buymultijump_clcmd[] = "say jump"
new const g_multijump_amount = 1 // Amount of multijumps given on purchase
new const g_multijump_limit = 2 //Max multijumps a human can jump

/*============================================ ================================*/

public plugin_init()
{
register_plugin("[ClanD] Extra Item: Multijump", "1.0", "Ownedin3d!")
register_clcmd(g_buymultijump_clcmd, "hook_say")
}

// Human buys our upgrade, give him some multijumps
public hook_say(id)
{
if (!is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_ammo_packs(id) < g_item_cost)
return PLUGIN_CONTINUE;

new current_multijump = pev(id, pev_multijumpvalue)
if (current_multijump >= g_multijump_limit)
{
client_print(id, print_chat, "[ClanD] The Maximum Jumps Is 2")
return PLUGIN_CONTINUE;
}

set_pev(id, pev_multijumpvalue, float(current_multijump + g_multijump_amount))

zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) - g_item_cost)

return PLUGIN_HANDLED;
}



i appreciate to everyone who tried.:oops:

Diegorkable 08-12-2011 18:18

Re: i am doing right?
 
Put it in an PHP code, much easier for others to read.

PHP Code:

/*============================================ ================================*/

new const g_item_cost 15 // Cost of Multijump

// Say command through which multijump is bought
new const g_buymultijump_clcmd[] = "say jump"
new const g_multijump_amount // Amount of multijumps given on purchase
new const g_multijump_limit //Max multijumps a human can jump

/*============================================ ================================*/

public plugin_init()
{
register_plugin("[ClanD] Extra Item: Multijump""1.0""Ownedin3d!")
register_clcmd(g_buymultijump_clcmd"hook_say")
}

// Human buys our upgrade, give him some multijumps
public hook_say(id)
{
if (!
is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_ammo_packs(id) < g_item_cost)
return 
PLUGIN_CONTINUE;

new 
current_multijump pev(idpev_multijumpvalue)
if (
current_multijump >= g_multijump_limit)
{
client_print(idprint_chat"[ClanD] The Maximum Jumps Is 2")
return 
PLUGIN_CONTINUE;
}

set_pev(idpev_multijumpvaluefloat(current_multijump g_multijump_amount))

zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) - g_item_cost)

return 
PLUGIN_HANDLED;



ownedin3d 08-12-2011 18:25

Re: i am doing right?
 
Quote:

Originally Posted by Diegorkable (Post 1531284)
Put it in an PHP code, much easier for others to read.

PHP Code:

/*============================================ ================================*/

new const g_item_cost 15 // Cost of Multijump

// Say command through which multijump is bought
new const g_buymultijump_clcmd[] = "say jump"
new const g_multijump_amount // Amount of multijumps given on purchase
new const g_multijump_limit //Max multijumps a human can jump

/*============================================ ================================*/

public plugin_init()
{
register_plugin("[ClanD] Extra Item: Multijump""1.0""Ownedin3d!")
register_clcmd(g_buymultijump_clcmd"hook_say")
}

// Human buys our upgrade, give him some multijumps
public hook_say(id)
{
if (!
is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_ammo_packs(id) < g_item_cost)
return 
PLUGIN_CONTINUE;

new 
current_multijump pev(idpev_multijumpvalue)
if (
current_multijump >= g_multijump_limit)
{
client_print(idprint_chat"[ClanD] The Maximum Jumps Is 2")
return 
PLUGIN_CONTINUE;
}

set_pev(idpev_multijumpvaluefloat(current_multijump g_multijump_amount))

zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) - g_item_cost)

return 
PLUGIN_HANDLED;



What i Am Doing wrong? ::cry:

fysiks 08-13-2011 00:56

Re: i am doing right?
 
Where did you get that code? It is wrong. Did you modify it from the original already? What did you change? Did it work when you first got it?

ownedin3d 08-13-2011 11:38

Re: i am doing right?
 
Quote:

Originally Posted by fysiks (Post 1531453)
Where did you get that code? It is wrong. Did you modify it from the original already? What did you change? Did it work when you first got it?

when i got it it worked. but with no command. what im trying to do is register a command wich is" when i say "jump" i buy a jump.

can you make it?

fysiks 08-13-2011 19:46

Re: i am doing right?
 
Quote:

Originally Posted by ownedin3d (Post 1531724)
when i got it it worked. but with no command. what im trying to do is register a command wich is" when i say "jump" i buy a jump.

can you make it?

None of your plugin makes any sense. Where is the original plugin that is for buying the jumps?


All times are GMT -4. The time now is 03:29.

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