Coding Help/Re-API Supported
-
czirimbolo
- Veteran Member
- Posts: 598
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#1
Post
by czirimbolo » 4 years ago
@Raheem can you help me?
L 01/20/2020 - 19:46:16: [AMXX] Displaying debug trace (plugin "ze_give_xp.amxx", version "1.0")
L 01/20/2020 - 19:46:16: [AMXX] Run time error 10: native error (native "ze_set_user_xp")
L 01/20/2020 - 19:46:16: [AMXX] [0] ze_give_xp.sma::Cmd_GiveXP (line 35)
#include <zombie_escape>
#include <ze_levels>
#define ACCESS ADMIN_RCON
public plugin_init ()
{
register_plugin("[ZE] Give XP", "1.0", "?")
register_clcmd("ze_givexp", "Cmd_GiveXP", ACCESS, "- ze_givexp <name> <amount>")
}
public Cmd_GiveXP(id)
{
if (!(get_user_flags(id) & ACCESS))
{
client_print(id, print_console, "You have no access to that command")
return PLUGIN_HANDLED
}
new szName[32], szAmount[10]
read_argv (1, szName, charsmax (szName))
read_argv (2, szAmount, charsmax (szAmount))
new iTargetIndex = get_user_index(szName)
if (!iTargetIndex)
{
client_print(id, print_console, "[ZE] Player not found!")
return PLUGIN_HANDLED
}
new iXPAmout = str_to_num (szAmount)
ze_set_user_xp(iTargetIndex, ze_get_user_xp(iTargetIndex) + iXPAmout)
return PLUGIN_HANDLED
}
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#2
Post
by Raheem » 4 years ago
Check if the targeted user connected or not:
#include <zombie_escape>
#include <ze_levels>
#define ACCESS ADMIN_RCON
public plugin_init ()
{
register_plugin("[ZE] Give XP", "1.0", "?")
register_clcmd("ze_givexp", "Cmd_GiveXP", ACCESS, "- ze_givexp <name> <amount>")
}
public Cmd_GiveXP(id)
{
if (!(get_user_flags(id) & ACCESS))
{
client_print(id, print_console, "You have no access to that command")
return PLUGIN_HANDLED
}
new szName[32], szAmount[10]
read_argv (1, szName, charsmax (szName))
read_argv (2, szAmount, charsmax (szAmount))
new iTargetIndex = get_user_index(szName)
if (!is_user_connected(iTargetIndex))
return PLUGIN_HANDLED
if (!iTargetIndex)
{
client_print(id, print_console, "[ZE] Player not found!")
return PLUGIN_HANDLED
}
new iXPAmout = str_to_num (szAmount)
ze_set_user_xp(iTargetIndex, ze_get_user_xp(iTargetIndex) + iXPAmout)
return PLUGIN_HANDLED
}
He who fails to plan is planning to fail
-
BandiT
- Member
- Posts: 59
- Joined: 4 years ago
-
Contact:
-
Quote
-
0
login to like this post
#3
Post
by BandiT » 4 years ago
The plugin is working good, nice job
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute
Register
Sign in
Users browsing this forum: No registered users and 6 guests