Raised This Month: $51 Target: $400
 12% 

[help] sma compiling mistakes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 07-12-2017 , 09:05   [help] sma compiling mistakes
Reply With Quote #1

I made some changes in sma but it is generating me these errors that I can not correct, could anyone help me?

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

Error: Symbol already defined: "RegisterHam" on line 79
Error: Expected token: ";", but found "}" on line 85
Warning: Loose indentation on line 90
Warning: Tag mismatch on line 90
Warning: Tag mismatch on line 90
Warning: Tag mismatch on line 90
Warning: Tag mismatch on line 90
Error: Invalid function or declaration on line 93

3 Errors.
Could not locate output file C:\Users\arsmi\Desktop\AMXX_Studio_1.4.3_fina l\compiled\cs_system_rank_v1.1.amx (compile failed).

Code:

#include <amxmodx>
#include <fvault>
#include <cstrike>
#include <wm_play>
#include <hamsandwich>



#define PLUGIN "CS: Sistema de rank+xp+level"
#define VERSION "1.1"

#define maxranks 15
#define maxlevels 50

#define xPrefix "RANK"

#define RANKS_RECRUTA 0
#define RANKS_SOLDADO 1
#define RANKS_SOLDADO_RASO 2
#define RANKS_ESPECIALISTA 3
#define RANKS_ESPECIALISTA_TECNICO 4
#define RANKS_PATRULEIRO 5
#define RANKS_CABO 6
#define RANKS_LIDER_DE_TIRO 7
#define RANKS_SARGENTO 8
#define RANKS_SARGENTO_DE_APOIO 9
#define RANKS_SARGENTO_MESTRE 10
#define RANKS_SARGENTO_MAIOR 11
#define RANKS_INTENDENTE 12
#define RANKS_ASPIRANTE 13
#define RANKS_GUERREIRO 14

new const db_save[] = "level_xp_rank"

new level[33], xp[33], rank[33], cvars[3], g_status_sync

new const xp_num[maxlevels+1] = { 15, 70, 150, 250, 350, 450, 550, 650, 750, 850, 950, 1050, 1150, 1250, 1350, 1450, 1550, 1650,
1750, 1850, 1950, 2050, 2150, 2250, 2350, 2450, 2550,2650, 2750, 2850, 2950, 3050, 3150, 3250, 3350, 3450, 3550, 3650,
3750, 3850, 3950, 4050, 4150, 4250, 4350, 4450, 4550, 4650, 4750, 5000 }

new const ranks_nomes[maxranks][]=
{
"Recruta",
"Soldado",
"Soldado Raso",
"Especialista",
"Especialista Tecnico",
"Patrulheiro",
"Cabo",
"Lider de Tiro",
"Sargento",
"Sargento de Apoio",
"Sargento Mestre",
"Sargento Maior",
"Intendente",
"Aspirante",
"Gurreiro Das Trevas"
}

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

// sistema de xp+lvl+rank
cvars[0] = register_cvar("rank_level_bonus", "500") // Quantidade de dinheiro ao passar de level
cvars[1] = register_cvar("rank_salvamente_tipo", "3") // 1 - IP || 2 - Nick || 3 - SteamID


register_event("StatusValue", "showStatus", "be", "1=2", "2!0")
register_event("StatusValue", "hideStatus", "be", "1=1", "2=0")
register_event("DeathMsg", "xDeathMsg", "a", "1>0") // Usado para add xps, e etc..

g_status_sync = CreateHudSyncObj()
}

/*----------------------------------------------------------------------------------------------------------------
-HUD DO JOGO
----------------------------------------------------------------------------------------------------------------*/
RegisterHam(Ham_Spawn,*"player",*"fwHamPlayer SpawnPost",*1)**
public fwHamPlayerSpawnPost(id)
{
if(!task_exists(id+3017))

{
set_task(1.0, "showHud", id+3017, .flags = "a", .repeat = 13)}
}
public showHud(id)
{
id = 3017
set_hudmessage(0.80, -1.0, 0, 1.0, 1.1, 0.0, 0.0, -1)
show_hudmessage(id,"» Level: %d/%d^n» Rank: %s^n» XP: %d/%d", level[id], maxlevels, ranks_nomes[rank[id]], xp[id], xp[id])
}
else
{
set_hudmessage(255, 255, 255, 0.80, -1.0, 0, 1.0, 1.1, 0.0, 0.0, -1)
show_hudmessage(id,"» Level: %d/%d^n» Rank: %s^n» XP: %d/%d", level[id], maxlevels, ranks_nomes[rank[id]], xp[id], xp_num[level[id]])
}
}

/*----------------------------------------------------------------------------------------------------------------
-EVENTO PARA ADD XP
----------------------------------------------------------------------------------------------------------------*/
public xDeathMsg()
{
new id = read_data(1)
new hs = read_data(3)

xp[id]++

if(hs)
xp[id] += 3

check_level(id, 1)
salvar_dados(id)
}

/*----------------------------------------------------------------------------------------------------------------
-CHECAR O LEVEL OU ADD++
----------------------------------------------------------------------------------------------------------------*/
public check_level(id, sound)
{
if(!is_user_connected(id)) return PLUGIN_HANDLED;

new nome[32]; get_user_name(id, nome, 31)

if(level[id] < maxlevels)
{
while(xp[id] >= xp_num[level[id]])
{
level[id]++

if(sound)
{
if(level[id] == maxlevels)
{
client_print_color(id, "!g[%s] !yVoce atingiu o level maximo. Level maximo: !t%s!y.", xPrefix, level[id])
client_print_color(0, "!g%s !yatingiu o level maximo. Level maximo: !t%s!y.", nome, level[id])

//client_cmd(0, "spk ambience/wolfhowl02.wav")

return PLUGIN_HANDLED
}

client_print_color(0, "!g%s !yganhou !t%d !yde dinheiro por subir de level.", nome, get_pcvar_num(cvars[0]))
cs_set_user_money(id, cs_get_user_money(id) + get_pcvar_num(cvars[0]))

//client_cmd(0, "spk ambience/wolfhowl02.wav")

set_ranks(id)
}
}
}

// Prevençoes de bugs... (Voltar ao maximo)
if(level[id] == maxlevels && xp[id] > xp_num[level[id]-1])
{
xp[id] = xp_num[level[id]-1]
salvar_dados(id)
}

if(level[id] >= maxlevels)
{
level[id] = maxlevels
xp[id] = xp_num[level[id]-1]
salvar_dados(id)
}

return PLUGIN_HANDLED
}

/*----------------------------------------------------------------------------------------------------------------
-SETAR A POSICAO DO RANK
----------------------------------------------------------------------------------------------------------------*/
public set_ranks(id)
{
if(level[id] <= 2) rank[id] = RANKS_RECRUTA
if(level[id] >= 2) rank[id] = RANKS_SOLDADO
if(level[id] >= 5) rank[id] = RANKS_SOLDADO_RASO
if(level[id] >= rank[id] = RANKS_ESPECIALISTA
if(level[id] >= 11) rank[id] = RANKS_ESPECIALISTA_TECNICO
if(level[id] >= 14) rank[id] = RANKS_PATRULEIRO
if(level[id] >= 17) rank[id] = RANKS_CABO
if(level[id] >= 20) rank[id] = RANKS_LIDER_DE_TIRO
if(level[id] >= 23) rank[id] = RANKS_SARGENTO
if(level[id] >= 26) rank[id] = RANKS_SARGENTO_DE_APOIO
if(level[id] >= 29) rank[id] = RANKS_SARGENTO_MESTRE
if(level[id] >= 32) rank[id] = RANKS_SARGENTO_MAIOR
if(level[id] >= 33) rank[id] = RANKS_INTENDENTE
if(level[id] >= 36) rank[id] = RANKS_ASPIRANTE
if(level[id] >= 43) rank[id] = RANKS_GUERREIRO
}

/*----------------------------------------------------------------------------------------------------------------
-SALVAR LEVEL,XP E RANK
----------------------------------------------------------------------------------------------------------------*/
public salvar_dados(id)
{
if(!is_user_connected(id)) return PLUGIN_HANDLED;

new auth[40], data[50]

switch(get_pcvar_num(cvars[1]))
{
case 1: get_user_ip(id, auth, charsmax(auth), 1)
case 2: get_user_name(id, auth, charsmax(auth))
case 3: get_user_authid(id, auth, charsmax(auth))
}

formatex(data, charsmax(data), "%d %d", level[id], xp[id])

fvault_pset_data(db_save, auth, data)

return PLUGIN_HANDLED;
}

/*----------------------------------------------------------------------------------------------------------------
-CARREGAR DADOS
----------------------------------------------------------------------------------------------------------------*/
public client_putinserver(id)
{
new auth[40], data[50], x1[10], x2[10]

switch(get_pcvar_num(cvars[1]))
{
case 1: get_user_ip(id, auth, charsmax(auth), 1)
case 2: get_user_name(id, auth, charsmax(auth))
case 3: get_user_authid(id, auth, charsmax(auth))
}

fvault_get_data(db_save, auth, data, charsmax(data))
parse(data, x1, charsmax(x1), x2, charsmax(x2))

level[id] = str_to_num(x1)
xp[id] = str_to_num(x2)

set_task(2.0, "set_ranks", id)
check_level(id, 0)

set_task(1.1, "hud_status", id, _, _, "b")
}

/*----------------------------------------------------------------------------------------------------------------
-MOSTRAR XP AO MIRAR NA PESSOA
----------------------------------------------------------------------------------------------------------------*/

public showStatus(id)
{
if(!is_user_bot(id) && is_user_connected(id))
{
new name[32], pid = read_data(2)

get_user_name(pid, name, 31)
new color1 = 0, color2 = 0

new xxx = get_user_team(id)
new xxx2 = get_user_team(pid)

new team1 = xxx == 1, team2 = xxx2 == 1

if (team2 == 1)
color1 = 255
else
color2 = 255

if (team1 == team2) // friend
{
set_hudmessage(color1, 50, color2, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, -1)
ShowSyncHudMsg(id, g_status_sync, "Nome: %s^nRank: %s^nLevel: %d^nXP: %d/%d", name, ranks_nomes[rank[pid]], level[pid], xp[pid], xp_num[level[pid]])
}
}
}

public hideStatus(id)
{
ClearSyncHud(id, g_status_sync)
}
Attached Files
File Type: sma Get Plugin or Get Source (cs_system_rank_v1.1.sma - 372 views - 8.2 KB)
iceeedr is offline
Send a message via Skype™ to iceeedr
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 07-12-2017 , 12:55   Re: [help] sma compiling mistakes
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=294867
Check the stolen version. ;)
__________________
Relaxing is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 07-12-2017 , 13:31   Re: [help] sma compiling mistakes
Reply With Quote #3

Quote:
Originally Posted by Relaxing View Post
I did not steal anything, I got this sma on the internet already translated to PT, but I changed the HUD as I said above, to appear in the respawn for 13 seconds (the plugin will stay on a pug server) and in the change I ended up doing nonsense And I can not fix it, so could you help me?
iceeedr is offline
Send a message via Skype™ to iceeedr
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-12-2017 , 23:47   Re: [help] sma compiling mistakes
Reply With Quote #4

[Bp]
Cara, ta uma bagunça essa parada ae. Coloca entre a tag code. O RegisterHam tem que ir dentro do plugin_init e não fora.

[En]
Add the plugin code in the code tag. RegisterHam must be added on plugin_[init|precache]
__________________








CrazY. is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-15-2017 , 04:56   Re: [help] sma compiling mistakes
Reply With Quote #5

Quote:
Originally Posted by CrazY. View Post
[Bp]
Cara, ta uma bagunça essa parada ae. Coloca entre a tag code. O RegisterHam tem que ir dentro do plugin_init e não fora.

[En]
Add the plugin code in the code tag. RegisterHam must be added on plugin_[init|precache]
On any native from plugin_natives/precache/init/cfg it's possible.
eyal282 is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 07-17-2017 , 23:28   Re: [help] sma compiling mistakes
Reply With Quote #6

Some help? kkkk
iceeedr is offline
Send a message via Skype™ to iceeedr
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 18:59.


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