AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   I need a bit of help with my SJ EXP plugin :/ (https://forums.alliedmods.net/showthread.php?t=113227)

qlail 12-24-2009 15:49

I need a bit of help with my SJ EXP plugin :/
 
Ok, I used this plugin originally from a soccerjam mod found on this forum, I just took it out of someones soccerjam.sma and used their codes but I can't seem to understand why these errors are coming up. So do you guys mind helping me.

PHP Code:

// Soccerjam EXP Plugin
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Soccerjam EXP"
#define VERSION "1.0"
#define AUTHOR "Thelius"
#define g_Experience
public plugin_init()
{
 
register_concmd("amx_givexp""concmd_GiveXP"ADMIN_LEVEL_A"<nick, #userid, authid> <xp to give>");
 
register_concmd("amx_takexp""concmd_GiveXP"ADMIN_LEVEL_A"<nick, #userid, authid> <xp to take>");
}
public 
concmd_GiveXP(idlevelcid)
{
 if(!
cmd_access(idlevelcid2))
  return 
PLUGIN_HANDLED;
 
 new 
arg[35];
 
read_argv(1arg34);
 new 
player cmd_target(idarg3);
 if(!
player)
  return 
PLUGIN_HANDLED;
 
 
read_argv(2arg15);
 new 
xp str_to_num(arg);
 if(
xp g_Experience[player])
  
xp g_Experience[player];
 
 
g_Experience[player] += xp;
 
 new 
nameA[32], nameP[32];
 
get_user_name(idnameA31);
 
get_user_name(playernameP31);
 
client_print(0print_chat"ADMIN %s: gave %d XP to %s!"nameAxpnameP);
 
 new 
authidA[32], authidP[32];
 
get_user_authid(idauthidA31);
 
get_user_authid(idauthidP31);
 
log_amx("%s <%s> gave %d XP to %s <%s>"nameAauthidAxpnamePauthidP);
 return 
PLUGIN_HANDLED;
}
public 
concmd_TakeXP(idlevelcid)
{
 if(!
cmd_access(idlevelcid2))
  return 
PLUGIN_HANDLED;
 
 new 
arg[35];
 
read_argv(1arg34);
 new 
player cmd_target(idarg3);
 if(!
player)
  return 
PLUGIN_HANDLED;
 
 
read_argv(2arg15);
 new 
xp str_to_num(arg);
 if(
xp g_Experience[player])
  
xp g_Experience[player];
 
 
g_Experience[player] -= xp;
 
 new 
string[16];
 if(
g_Experience[player] > 0)
  
formatex(string15"%d"xp);
 else
  
formatex(string15"all");
 
 new 
nameA[32], nameP[32];
 
get_user_name(idnameA31);
 
get_user_name(playernameP31);
 
client_print(0print_chat"ADMIN %s: took %s XP from %s!"stringnameP);
 
 new 
authidA[32], authidP[32];
 
get_user_authid(idauthidA31);
 
get_user_authid(idauthidP31);
 
log_amx("%s <%s> took %d XP from %s <%s>"nameAauthidAxpnamePauthidP);
 return 
PLUGIN_HANDLED;


I got these errors
sjexp.sma(31) : error 029: invalid expression, assumed zero
sjexp.sma(31) : warning 215: expression has no effect
sjexp.sma(31) : error 001: expected token: ";", but found "]"
sjexp.sma(31) : error 029: invalid expression, assumed zero
sjexp.sma(31) : fatal error 107: too many error messages on one line

Hasler 12-26-2009 09:39

Re: I need a bit of help with my SJ EXP plugin :/
 
1 Attachment(s)
well, the first thing you do is open your sma of SoccerJam and search the line plugin_natives()

and replace all of that for this

PHP Code:

public plugin_natives () (
    
register_native (sj_get_user_experience "," native_get_user_experience ", 1)
    register_native (sj_set_user_experience "
," native_set_user_experience "1)
    
register_native (sj_get_ballowner_id "," native_get_ballowner_id ", 1)


Then below it add
PHP Code:

public native_get_user_experience (id)
    
g_Experience return [id]

public 
native_set_user_experience (idexp)
    
g_Experience [id] = exp 

and add this external plugin or if you want to put it in the same SoccerJam

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <soccerjam_util>

#define PLUGIN "Amx_dar_exp"
#define VERSION "1.0"
#define AUTHOR "-"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_concmd("amx_exp","CmdGiveExp",ADMIN_BAN,"<target> <exp>")
}


public 
CmdGiveExp(id,level,cid){
    
    if(!
cmd_access(id,level,cid,2)) return PLUGIN_HANDLED;
    
    new 
szArg[32]
    
read_argv(1,szArg,31)
    
    new 
szArg2[32
    
read_argv(2,szArg2,31)
    
    new 
iExp str_to_num(szArg2)
    
    new 
iTarget cmd_target(id,szArg,0)
    
    if(!
iTarget) return PLUGIN_HANDLED
    
    
new szAdminName[32],szTargetName[32]
    
    
get_user_name(id,szAdminName,31)
    
get_user_name(iTarget,szTargetName,31)
    
    
client_print(0,print_chat,"ADMIN %s set %i Exp on %s",szAdminName,iExp,szTargetName)
    
    
sj_set_user_experience(iTargetsj_get_user_experience(iTarget) + iExp)
    
    return 
PLUGIN_HANDLED




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

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