AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   xmas editing (https://forums.alliedmods.net/showthread.php?t=63798)

heroeskiller 11-30-2007 10:07

xmas editing
 
Hello,
iam editing that XMas plugin for shmod
Code:

    {
    new randomXP = random_num(100, 1000);
    server_cmd("amx_shaddxp", pToucher, randomXP);
    server_exec();
    client_print(pToucher, print_chat, "[presentsSpawner] %L", pToucher, "You got XP:", randomXP);
    }

But i get always a error, when ppl are trying to pickup a present:
Usage: amx_shaddxp <nick | @team | @ALL | #userid> <xp> - Adds XP to Players

purple_pixie 11-30-2007 10:12

Re: xmas editing
 
1) What error?

2) parameter 2 of amx_shaddxp should be a string.
You need to replace:
Code:
     server_cmd("amx_shaddxp", pToucher, randomXP);
With:
Code:
     new target[12] ;      target[0]='#'      num_to_str(get_user_userid(pToucher),target[1],sizeof target-2)      server_cmd("amx_shaddxp", target, randomXP);

heroeskiller 11-30-2007 10:28

Re: xmas editing
 
the message doesnt accept "randomXP" :/
It could be also the error why it still doenst work with giving xp

purple_pixie 11-30-2007 10:32

Re: xmas editing
 
Alrighty ... we'll make that a string too.

Code:
{     new randomXP = random_num(100, 1000);     new target[12],xp[5] ;     target[0]='#'     num_to_str(get_user_userid(pToucher),target[1],sizeof target-2)     num_to_str(randomXP,xp,sizeof xp-1);     server_cmd("amx_shaddxp", target, xp);     server_exec();     client_print(pToucher, print_chat, "[presentsSpawner] %L", pToucher, "You got XP: %i", randomXP); }

Or you mean the "client_print" message?
That was missing a "%i"

heroeskiller 11-30-2007 10:38

Re: xmas editing
 
still doesnt work :/

purple_pixie 11-30-2007 10:43

Re: xmas editing
 
1) Is "debug" enabled for the plugin
(should be listed as "pluginname.amxx debug" in plugins.ini)

2) What is logged in the console when you pick up the present?

heroeskiller 11-30-2007 10:48

Re: xmas editing
 
Yes its enabled

But it only says:
Usage: amx_shaddxp <nick | @team | @ALL | #userid> <xp> - Adds XP to Players

purple_pixie 11-30-2007 10:53

Re: xmas editing
 
Ah.

My bad ... you need it like this:

Code:
     {      new randomXP = random_num(100, 1000);      server_cmd("amx_shaddxp %s%i %i", {'#',0},pToucher, randomXP);      server_exec();      client_print(pToucher, print_chat, "[presentsSpawner] %L", pToucher, "You got XP:", randomXP);      }

heroeskiller 11-30-2007 10:57

Re: xmas editing
 
Now it says: Client with that name or userid not found ^^

purple_pixie 11-30-2007 11:01

Re: xmas editing
 
Instead of "server_cmd" (or aswell as) put "log_amx" (with the same arguments) and tell me what that logs.


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

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