Raised This Month: $32 Target: $400
 8% 

[Request] Inquire about some coding errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-19-2020 , 08:24   [Request] Inquire about some coding errors
Reply With Quote #1

Hello Guys,
yesterday i have made simple level xp system and i was want to combine it to basebuilder mod , i did it but i have got 1 erorr, please guys can anyone tell me where is the problem ??

I want to add this codes

PHP Code:
public client_death(killervictimweaponhitplace)
{
    new 
victim_name[32]
    
get_user_name(victimvictim_namecharsmax(victim_name))
    
    new 
killer_team get_user_team(killer)
    new 
victim_team get_user_team(victim)
    
    
//NORMAL KILL
    
if((killer != victim) && !(killer_team == victim_team) && !(hitplace == HIT_HEAD) && !(weapon == CSW_HEGRENADE) && !(weapon == CSW_KNIFE))
    {
        
eXP[killer]+= get_pcvar_num(kill_xp)
    }
    
    
//HEADSHOT
    
if(hitplace == HIT_HEAD && !(weapon == CSW_KNIFE) && !(killer_team == victim_team))
    {
        
eXP[killer]+= get_pcvar_num(hs_xp)
    }
    
    
//KNIFE KILL
    
if(weapon == CSW_KNIFE && !(hitplace == HIT_HEAD) && !(killer_team == victim_team))
    {
        
eXP[killer]+= get_pcvar_num(knife_xp)
    }
    
    
//KNIFE + HEADSHOT
    
if(weapon == CSW_KNIFE && (hitplace == HIT_HEAD) && !(killer_team == victim_team))
    {
        
eXP[killer]+= get_pcvar_num(knife_xp)
    }
    
    
//GRENADE KILL
    
if(weapon == CSW_HEGRENADE && (killer != victim) && !(killer_team == victim_team))
    {
        
eXP[killer]+=get_pcvar_num(he_xp)
    }

    
CheckLevel(killer)
    
SaveData(killer)

with this codes
PHP Code:
public client_death(g_attackerg_victimwpnindexhitplaceTK)
{
    if (
is_user_alive(g_victim))
        return 
PLUGIN_HANDLED;
    
    
remove_task(g_victim+TASK_IDLESOUND)
    
    
g_isAlive[g_victim] = false;
    
    if (
TK == && g_attacker != g_victim && g_isZombie[g_attacker])
    {
        
client_cmd(0"spk %s"INFECTION)
        new 
szPlayerName[32]
        
get_user_name(g_victimszPlayerName31)
        
set_hudmessage(0255255, -1.0, -1.006.012.0);
        
show_hudmessage(0"%L"LANG_SERVER"INFECT_ANNOUNCE"szPlayerName);
    }
    
    
set_hudmessage(0255255, -1.0, -1.006.012.0);
    if (
g_isZombie[g_victim])
    {
        
show_hudmessage(g_victim"%L"LANG_SERVER"DEATH_ZOMBIE"g_iZombieTime);
        
set_task(float(g_iZombieTime), "Respawn_Player"g_victim+TASK_RESPAWN)
    }
    else if (
g_iInfectTime)
    {
        
show_hudmessage(g_victim"%L"LANG_SERVER"DEATH_HUMAN"g_iInfectTime);
        
cs_set_user_team(g_victimCS_TEAM_T)
        
g_isZombie[g_victim] = true
        set_task
(float(g_iInfectTime), "Respawn_Player"g_victim+TASK_RESPAWN)
    }
    
    return 
PLUGIN_CONTINUE;    


I did it but i have got 1 error so can anyone tell me where is the problem ???

PHP Code:
public client_death(g_attackerg_victimwpnindexhitplacekillervictimweaponTK)
{
    new 
victim_name[32]
    
get_user_name(victimvictim_namecharsmax(victim_name))
    
    new 
killer_team get_user_team(killer)
    new 
victim_team get_user_team(victim)
    
    
//NORMAL KILL
    
if((killer != victim) && !(killer_team == victim_team) && !(hitplace == HIT_HEAD) && !(weapon == CSW_HEGRENADE) && !(weapon == CSW_KNIFE))
    {
        
eXP[killer]+= get_pcvar_num(kill_xp)
    }
    
    
//HEADSHOT
    
if(hitplace == HIT_HEAD && !(weapon == CSW_KNIFE) && !(killer_team == victim_team))
    {
        
eXP[killer]+= get_pcvar_num(hs_xp)
    }
    
    
//KNIFE KILL
    
if(weapon == CSW_KNIFE && !(hitplace == HIT_HEAD) && !(killer_team == victim_team))
    {
        
eXP[killer]+= get_pcvar_num(knife_xp)
    }
    
    
//KNIFE + HEADSHOT
    
if(weapon == CSW_KNIFE && (hitplace == HIT_HEAD) && !(killer_team == victim_team))
    {
        
eXP[killer]+= get_pcvar_num(knife_xp)
    }
    
    
//GRENADE KILL
    
if(weapon == CSW_HEGRENADE && (killer != victim) && !(killer_team == victim_team))
    {
        
eXP[killer]+=get_pcvar_num(he_xp)
    }

    
CheckLevel(killer)
    
SaveData(killer)
    
    if (
is_user_alive(g_victim))
        return 
PLUGIN_HANDLED;
    
    
remove_task(g_victim+TASK_IDLESOUND)
    
    
g_isAlive[g_victim] = false;
    
    if (
TK == && g_attacker != g_victim && g_isZombie[g_attacker])
    {
        
client_cmd(0"spk %s"INFECTION)
        new 
szPlayerName[32]
        
get_user_name(g_victimszPlayerName31)
        
set_hudmessage(0255255, -1.0, -1.006.012.0);
        
show_hudmessage(0"%L"LANG_SERVER"INFECT_ANNOUNCE"szPlayerName);
    }
    
    
set_hudmessage(0255255, -1.0, -1.006.012.0);
    if (
g_isZombie[g_victim])
    {
        
show_hudmessage(g_victim"%L"LANG_SERVER"DEATH_ZOMBIE"g_iZombieTime);
        
set_task(float(g_iZombieTime), "Respawn_Player"g_victim+TASK_RESPAWN)
    }
    else if (
g_iInfectTime)
    {
        
show_hudmessage(g_victim"%L"LANG_SERVER"DEATH_HUMAN"g_iInfectTime);
        
cs_set_user_team(g_victimCS_TEAM_T)
        
g_isZombie[g_victim] = true
        set_task
(float(g_iInfectTime), "Respawn_Player"g_victim+TASK_RESPAWN)
    }
    
    return 
PLUGIN_CONTINUE;    


Quote:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Error: Function heading differs from prototype on line 1453

1 Error.
Could not locate output file C:\Users\mohamed\Desktop\BaseBuilder.amx (compile failed).

Last edited by Supremache; 05-19-2020 at 08:40.
Supremache is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-19-2020 , 10:20   Re: [Request] Inquire about some coding errors
Reply With Quote #2

And which line is #1453?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-19-2020 , 10:34   Re: [Request] Inquire about some coding errors
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
And which line is #1453?
This :
PHP Code:
public client_death(g_attackerg_victimwpnindexhitplacekillervictimweaponTK
Supremache is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-19-2020 , 10:47   Re: [Request] Inquire about some coding errors
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
And which line is #1453?
This is plugin that i have did
PHP Code:
#include <amxmodx>
#include <amxmisc>  
#include <cstrike>
#include <fvault>

#define MaxLevels 51

new Level[33], eXP[33]
new 
LevelBonusknife_xphe_xphs_xpkill_xp

new const g_vault_name[] = "levelsz";

new const 
Levels[MaxLevels] = 
{
    
90,
    
180
    
300,  
    
450
    
700,
    
1200,
    
1800,
    
2800,
    
4100,
    
5200,
    
6000,
    
6800,
    
8200,
    
10200,
    
12000,
    
15000,
    
17500,
    
20500,
    
25500,
    
29000,
    
35000,
    
46000,
    
58000,
    
71000,
    
85000,
    
100000,
    
116000,
    
133000,
    
151000,
    
170000,
    
190000,
    
211000,
    
233000,
    
256000,
    
280000,
    
305000,
    
331000,
    
358000,
    
386000,
    
415000,
    
445000,
    
476000,
    
508000,
    
541000,
    
575000,
    
610000,
    
646000,
    
683000,
    
721000,
    
760000,
    
9999999
}

public 
plugin_init() 
{
    
register_plugin("Ranks & XP mod""1.0""alt.nick")
    
    
register_event("DeathMsg","level_client_death","a"
    
register_clcmd("say""hook_say")
    
register_clcmd("say_team""hook_say")
    
register_clcmd("say /xp""cmdRank")
    
register_clcmd("say_team /xp""cmdRank")
    
register_clcmd("say /level""cmdRank")
    
register_clcmd("say_team /level""cmdRank")
    
register_clcmd("say /lvl""cmdRank")
    
register_clcmd("say_team /lvl""cmdRank")

  
    
LevelBonus register_cvar("Level Up Bonus""10000")
    
knife_xp register_cvar("knife_xp""2")
    
he_xp register_cvar("he_xp""1")
    
hs_xp register_cvar("hs_xp""2")
    
kill_xp register_cvar("kill_xp""1"
    
    
register_concmd ("amx_give_xp""CmdAddXP"ADMIN_LEVEL_A"<nick | ct | t | @all> <xp>")
    
    
fvault_load(g_vault_name)
}

public 
ShowHud(id
{
        
set_hudmessage(2552552550.80, -1.001.01.10.00.0, -1)
        
show_hudmessage(id"XP: %i / %i ^nLevel: %i"eXP[id], Levels[Level[id]], Level[id])

}

public 
client_putinserver(id)
{
    
set_task(1.0"ShowHud"id__"b")
    if(
Level[id] < MaxLevels-1)
    while(
eXP[id] >= Levels[Level[id]])
    
Level[id] += 
}

public 
client_death(killervictimweaponhitplace)
{
    new 
victim_name[32]
    
get_user_name(victimvictim_namecharsmax(victim_name))
    
    new 
killer_team get_user_team(killer)
    new 
victim_team get_user_team(victim)
    
    
//NORMAL KILL
    
if((killer != victim) && !(killer_team == victim_team) && !(hitplace == HIT_HEAD) && !(weapon == CSW_HEGRENADE) && !(weapon == CSW_KNIFE))
    {
        
eXP[killer]+= get_pcvar_num(kill_xp)
    }
    
    
//HEADSHOT
    
if(hitplace == HIT_HEAD && !(weapon == CSW_KNIFE) && !(killer_team == victim_team))
    {
        
eXP[killer]+= get_pcvar_num(hs_xp)
    }
    
    
//KNIFE KILL
    
if(weapon == CSW_KNIFE && !(hitplace == HIT_HEAD) && !(killer_team == victim_team))
    {
        
eXP[killer]+= get_pcvar_num(knife_xp)
    }
    
    
//KNIFE + HEADSHOT
    
if(weapon == CSW_KNIFE && (hitplace == HIT_HEAD) && !(killer_team == victim_team))
    {
        
eXP[killer]+= get_pcvar_num(knife_xp)
    }
    
    
//GRENADE KILL
    
if(weapon == CSW_HEGRENADE && (killer != victim) && !(killer_team == victim_team))
    {
        
eXP[killer]+=get_pcvar_num(he_xp)
    }

    
CheckLevel(killer)
    
SaveData(killer)
}


public 
CheckLevel(id)
{
    if(
Level[id] < MaxLevels-1)
    while(
eXP[id] >= Levels[Level[id]])
    
Level[id] += 1
    cs_set_user_money
(idcs_get_user_money(id) + get_pcvar_num(LevelBonus))
    
client_print(idprint_chat"Level: %d | You have got %s$ for your level upgrade,",Level[id], LevelBonus)
}

public 
client_connect(id)
{
    
LoadData(id)
}


public 
client_disconnect(id)
{
    
SaveData(id)
    
eXP[id] = 0
    Level
[id] = 0
    remove_task
(id)
}
        

        
public 
cmdRank(id)
{
    if(
is_user_connected(id))
    
client_print(idprint_chat"XP: %d / %d | Level: %d / 50."eXP[id], Levels[Level[id]], Level[id])

}
        
public 
CmdAddXP (iPlayerlevelcid)
{
    if(!
cmd_access(iPlayerlevelcid3)) return PLUGIN_HANDLED;
        
    new 
arg [32]
    
read_argv (1arg31
 
    new 
AddXP [32]
    
read_argv (2AddXPcharsmax (AddXP))
 
    new 
XPtoGive str_to_num (AddXP)
        
    new 
AdminName [32]
    new 
TargetName [32]
    
get_user_name (iPlayerAdminNamecharsmax (AdminName))
        
    if(
arg[0]=='@')
    { 
        if(
equali(arg[1],"All") || equali(arg[1],"ALL"))
        {
            new 
players[32], totalplayersAll
            get_players
(playerstotalplayers)
             
            for (new 
0totalplayersi++)
            {
                
All players[i]
                        
                
eXP[All] += XPtoGive
            
}
            
            
CheckLevel(All)
            
client_print(0print_chat"Admin %s gave %i XP to all players!"AdminNameXPtoGive)
        }
        else if(
equali(arg[1],"T") || equali(arg[1],"t"))
        {
            new 
players[32], totalplayersT
            get_players
(playerstotalplayers)
             
            for (new 
0totalplayersi++)
            {
                if (
get_user_team(players[i]) == 1)
                {
                    
players[i]
                            
                    
eXP[T] += XPtoGive
                
}
            }
            
            
CheckLevel(T)
            
client_print(0print_chat"Admin %s gave %i XP to all Zombies."AdminNameXPtoGive)
        }
        else if(
equali(arg[1],"CT") || equali(arg[1],"ct"))
        {
            new 
players[32], totalplayersCT
            get_players
(playerstotalplayers)
             
            for(new 
0totalplayersi++)
            {
                if(
get_user_team(players[i]) == 2)
                {
                    
CT players[i]
                            
                    
eXP[CT] += XPtoGive
                
}
            }
            
            
CheckLevel(CT)
            
client_print(0print_chat"Admin %s gave %i XP to all Humans."AdminNameXPtoGive)
        }
    }
    else
    {
        new 
iTarget cmd_target(iPlayerarg3)
        
get_user_name (iTargetTargetNamecharsmax (TargetName))
        
        if(
iTarget)
        {
            
eXP[iTarget] += XPtoGive
            
            CheckLevel
(iTarget)
            
client_print(0print_chat"Admin %s gave %i XP to %s."AdminNameXPtoGiveTargetName)
        }
    }
    return 
PLUGIN_HANDLED
}

bool:IsValidMessageszMessage[ ], iLen )
{
    
read_argsszMessageiLen )
    
remove_quotesszMessage )
   
    new 
iPoscChar
    
while( <= ( cChar szMessageiPos++ ] ) <= 255 )
    {
        if( 
cChar != ' ' && cChar != '%' )
        {
            return 
true
        
}
    }
   
    return 
false
}

public 
hook_say(id)
{
    if(!
is_user_connected(id)) 
        return 
PLUGIN_HANDLED_MAIN
    
    
new szArgs[192]
    
    if( !
IsValidMessage(szArgscharsmax(szArgs))) 
        return 
PLUGIN_HANDLED_MAIN

    
if(equal(szArgs,"")) return PLUGIN_HANDLED_MAIN

    
    
new szName[32]
    
get_user_name(idszNamesizeof szName-1)

    if(
contain(szArgs,"@") >= 0
    return  
PLUGIN_HANDLED_MAIN

        
    
return PLUGIN_HANDLED_MAIN
}
public 
SaveData(id)
{
    new 
name[32];
    
get_user_name(id,name,31);
    new 
vaultkey[64],vaultdata[256];
    
    
format(vaultkey,63,"%s"name);
    
format(vaultdata,255,"%i#%i#",eXP[id],Level[id]);
    
fvault_set_data(g_vault_name,vaultkey,vaultdata);
    
    return 
PLUGIN_CONTINUE;
}
public 
LoadData(id)
{
    new 
name[32];
    
get_user_name(id,name,31);
    new 
vaultkey[64],vaultdata[256];
    
    
format(vaultkey,63,"%s",name);
    
format(vaultdata,255,"%i#%i#",eXP[id],Level[id]);
    
fvault_get_data(g_vault_name,vaultkey,vaultdata,charsmax(vaultdata));
    
    
replace_all(vaultdata255"#"" ");
    new 
playerxp[32], playerlevel[32];
    
parse(vaultdataplayerxp31playerlevel31);
    
    
eXP[id] = str_to_num(playerxp);
    
Level[id] = str_to_num(playerlevel);
    
    return 
PLUGIN_CONTINUE;

Tell Me if there's anyproblems in this plugin and how to add public client_death codes of thsi plugin to public client_death codes of base builder mod
Supremache is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 05-19-2020 , 10:48   Re: [Request] Inquire about some coding errors
Reply With Quote #5

Quote:
Originally Posted by Supremache View Post
This :
PHP Code:
public client_death(g_attackerg_victimwpnindexhitplacekillervictimweaponTK
The error is self-explanatory.

PHP Code:
public client_death(killervictimwpnindexhitplaceTK
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-19-2020 , 10:58   Re: [Request] Inquire about some coding errors
Reply With Quote #6

Quote:
Originally Posted by iceeedr View Post
The error is self-explanatory.

PHP Code:
public client_death(killervictimwpnindexhitplaceTK
Do you mean public client_death(g_attacker, g_victim, wpnindex, hitplace, killer, victim, weapon, TK)
g_attacker = killer
g_victim = victim
wpnindex = weapon
???
Supremache is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 05-19-2020 , 11:01   Re: [Request] Inquire about some coding errors
Reply With Quote #7

Quote:
Originally Posted by Supremache View Post
Do you mean public client_death(g_attacker, g_victim, wpnindex, hitplace, killer, victim, weapon, TK)
g_attacker = killer
g_victim = victim
wpnindex = weapon
???

I'm saying that the function has 5 arguments and you can't change that.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-19-2020 , 11:03   Re: [Request] Inquire about some coding errors
Reply With Quote #8

Quote:
Originally Posted by iceeedr View Post
I'm saying that the function has 5 arguments and you can't change that.
Can i change it to get more arguments ??
Supremache is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-19-2020 , 11:34   Re: [Request] Inquire about some coding errors
Reply With Quote #9

Quote:
Originally Posted by iceeedr View Post
The error is self-explanatory.

PHP Code:
public client_death(killervictimwpnindexhitplaceTK
did there's anyproblems in those codes ?
PHP Code:
public client_death(killervictimweaponhitplace)
{
    new 
victim_name[32]
    
get_user_name(victimvictim_namecharsmax(victim_name))
    
    new 
killer_team get_user_team(killer)
    new 
victim_team get_user_team(victim)
    
    
//NORMAL KILL
    
if((killer != victim) && !(killer_team == victim_team) && !(hitplace == HIT_HEAD) && !(weapon == CSW_HEGRENADE) && !(weapon == CSW_KNIFE))
    {
        
eXP[killer]+= get_pcvar_num(kill_xp)
    }
    
    
//HEADSHOT
    
if(hitplace == HIT_HEAD && !(weapon == CSW_KNIFE) && !(killer_team == victim_team))
    {
        
eXP[killer]+= get_pcvar_num(hs_xp)
    }
    
    
//KNIFE KILL
    
if(weapon == CSW_KNIFE && !(hitplace == HIT_HEAD) && !(killer_team == victim_team))
    {
        
eXP[killer]+= get_pcvar_num(knife_xp)
    }
    
    
//KNIFE + HEADSHOT
    
if(weapon == CSW_KNIFE && (hitplace == HIT_HEAD) && !(killer_team == victim_team))
    {
        
eXP[killer]+= get_pcvar_num(knife_xp)
    }
    
    
//GRENADE KILL
    
if(weapon == CSW_HEGRENADE && (killer != victim) && !(killer_team == victim_team))
    {
        
eXP[killer]+=get_pcvar_num(he_xp)
    }

    
CheckLevel(killer)
    
SaveData(killer)

Because if i killed someone i didn't get any xp Oo , is that problem because zombie base builder mod ??
I have to add those options to client_death of basebuilder mod ?

Last edited by Supremache; 05-19-2020 at 11:34.
Supremache is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-19-2020 , 13:28   Re: [Request] Inquire about some coding errors
Reply With Quote #10

OciXCrom;2701021

You made rank system before, I think you can help me
Can you edit my plugin to when i kill someone i got "xp" headshot get "xp" knife "xp" knife headshot "xp" GRENADE "xp"

Because i think i did some problems in codes
I hope you help me..
Supremache is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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