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

I can't compile amxx


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
z4a7wq
Junior Member
Join Date: Jul 2012
Old 07-28-2012 , 06:16   I can't compile amxx
Reply With Quote #1

Hi everyone This is my first time I made sma

but i have some errors and I found many post but still can't solve

/tmp/textFbGDYX.sma(15) : error 028: invalid subscript (not an array or too many subscripts): "cs_get_user_team"
/tmp/textFbGDYX.sma(39) : error 017: undefined symbol "Register_logevent"
/tmp/textFbGDYX.sma(67) : warning 217: loose indentation
/tmp/textFbGDYX.sma(6 : warning 209: function "logevent_round_end" should return a value

2 Errors.


#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
new g_xp[33]
new g_pass[33]
new g_vault
new g_block[33]
new CsTeams:userTeam = cs_get_user_team[id]
new MaxPlayers;
new cts[32];
new ctnum;

#define PLUGIN_NAME "deathrun"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "z4a7wq"

public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);

register_clcmd( "say /save" ,"say_save")
register_clcmd( "say /dr" ,"say_dr")

register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")

RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")

RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")

Register_logevent("logevent_round_end", 2, "1=Round_End");
MaxPlayers = get_maxplayers();

g_vault = nvault_open("n_xp")
g_vault = nvault_open("n_pass")
g_vault = nvault_open("n_block")


}

public fw_PlayerKilled(victim, attacker, shouldgib)
{
if (attacker == victim || !is_user_connected(attacker))
return HAM_IGNORED

if (userTeam == CS_TEAM_CT) {
g_pass[attacker] += 1
g_xp[attacker] += 10
}return PLUGIN_CONTINUE;
}
public logevent_round_end()
for (new i = 1; i < MaxPlayers; ++i) {
if (userTeam == CS_TEAM_T) {
if (is_user_alive(i))
g_block[32] +=1
g_xp[32] +=get_players(cts, ctnum, "e", "CT")
}return PLUGIN_CONTINUE;
}
public say_save(id)
{

SaveData(id)
client_print(id, print_center, "成功儲存")
}
public say_dr(id)
client_print(id, print_center, "通關次數: %i 阻止CT次數: %i 總分數: %i ", g_pass[id], g_block, g_xp[id])

public client_putinserver(id)
LoadData(id)

public client_disconnect(id)
{
SaveData(id)
}
public SaveData(id)
{
new name[32], vaultkey[64], vaultdata[256]
get_user_name(id, name, 31)
format(vaultkey, 63, "%s-caxp", name)
format(vaultdata, 255, "%i#%i#%i#", g_pass[id], g_block[id], g_xp[id])
nvault_set(g_vault, vaultkey, vaultdata)
}
public LoadData(id)
{
new name[32], vaultkey[64], vaultdata[256]
get_user_name(id,name,31)
format(vaultkey, 63, "%s-caxp", name)
format(vaultdata, 255, "%i#%i#%i#", g_pass[id], g_block[id], g_xp[id])
nvault_get(g_vault, vaultkey, vaultdata, 255)

replace_all(vaultdata, 255, "#", " ")

new playerpass[32], playerblock[32], playerxp[32]

parse(vaultdata, playerpass, 31 , playerblock, 31 , playerxp, 31)

g_pass[id] = str_to_num(playerpass)
g_block[id] = str_to_num(playerblock)
g_xp[id] = str_to_num(playerxp)
}
z4a7wq is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 07-28-2012 , 08:03   Re: I can't compile amxx
Reply With Quote #2

The first error comes from the cs_get_user_team() native. You need to use parentheses for functions, square brackets are used for arrays.

The second error is because you used "Register_logevent" instead of "register_logevent". Pawn is case sensitive.

The third warning means your code is not properly indented and the last warning is because, as it says, "logevent_round_end" should return a value. Just add return PLUGIN_CONTINUE before the last bracket.
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
z4a7wq
Junior Member
Join Date: Jul 2012
Old 07-28-2012 , 09:05   Re: I can't compile amxx
Reply With Quote #3

Quote:
Originally Posted by Backstabnoob View Post
The first error comes from the cs_get_user_team() native. You need to use parentheses for functions, square brackets are used for arrays.

The second error is because you used "Register_logevent" instead of "register_logevent". Pawn is case sensitive.

The third warning means your code is not properly indented and the last warning is because, as it says, "logevent_round_end" should return a value. Just add return PLUGIN_CONTINUE before the last bracket.
Thank your answer

And I fixed first and second errors

and have new errors

/tmp/text60PIE4.sma(12) : error 017: undefined symbol "id"
/tmp/text60PIE4.sma(12 -- 13) : error 008: must be a constant expression; assumed zero

2 Errors.

#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
new g_xp[33]
new g_pass[33]
new g_block[33]
new g_vault
new CsTeams:userTeam = cs_get_user_team(id)
new MaxPlayers;
new cts[32];
new ctnum;
#define PLUGIN_NAME "deathrun"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "z4a7wq"
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_clcmd( "say /save" ,"say_save")
register_clcmd( "say /dr" ,"say_dr")
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
register_logevent("logevent_round_end", 2, "1=Round_End");
MaxPlayers = get_maxplayers();
g_vault = nvault_open("n_xp")
g_vault = nvault_open("n_pass")
g_vault = nvault_open("n_block")

}
public fw_PlayerKilled(victim, attacker, shouldgib)
{
if (attacker == victim || !is_user_connected(attacker))
return HAM_IGNORED
if (userTeam == CS_TEAM_CT) {
g_pass[attacker] += 1
g_xp[attacker] += 10
}return PLUGIN_CONTINUE;
}
public logevent_round_end()
{
for (new i = 1; i < MaxPlayers; ++i) {
if (userTeam == CS_TEAM_T) {
if (is_user_alive(i))
g_block[32] +=1
g_xp[32] +=get_players(cts, ctnum, "e", "CT")
}
}return PLUGIN_CONTINUE
}
public say_save(id)
{
SaveData(id)
client_print(id, print_center, "成功儲存")
}
public say_dr(id)
client_print(id, print_center, "通關次數: %i 阻止CT次數: %i 總分數: %i ", g_pass[id], g_block, g_xp[id])
public client_putinserver(id)
LoadData(id)
public client_disconnect(id)
{
SaveData(id)
}
public SaveData(id)
{
new name[32], vaultkey[64], vaultdata[256]
get_user_name(id, name, 31)
format(vaultkey, 63, "%s-caxp", name)
format(vaultdata, 255, "%i#%i#%i#", g_pass[id], g_block[id], g_xp[id])
nvault_set(g_vault, vaultkey, vaultdata)
}
public LoadData(id)
{
new name[32], vaultkey[64], vaultdata[256]
get_user_name(id,name,31)
format(vaultkey, 63, "%s-caxp", name)
format(vaultdata, 255, "%i#%i#%i#", g_pass[id], g_block[id], g_xp[id])
nvault_get(g_vault, vaultkey, vaultdata, 255)
replace_all(vaultdata, 255, "#", " ")
new playerpass[32], playerblock[32], playerxp[32]
parse(vaultdata, playerpass, 31 , playerblock, 31 , playerxp, 31)
g_pass[id] = str_to_num(playerpass)
g_block[id] = str_to_num(playerblock)
g_xp[id] = str_to_num(playerxp)
}

Last edited by z4a7wq; 07-28-2012 at 12:34.
z4a7wq is offline
pacheco
Senior Member
Join Date: Jul 2011
Old 07-28-2012 , 14:01   Re: I can't compile amxx
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>

new g_xp[33
new 
g_pass[33
new 
g_block[33]
new 
g_vault
new MaxPlayers;
new 
cts[32];
new 
ctnum;

#define PLUGIN_NAME "deathrun"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "z4a7wq"

public plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR);
    
register_clcmd"say /save" ,"say_save")
    
register_clcmd"say /dr" ,"say_dr")
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink"
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled"
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
register_logevent("logevent_round_end"2"1=Round_End");
    
MaxPlayers get_maxplayers();
    
g_vault nvault_open("n_xp")
    
g_vault nvault_open("n_pass")
    
g_vault nvault_open("n_block")
    
}

public 
fw_PlayerKilled(victimattackershouldgib
{
    if (
attacker == victim || !is_user_connected(attacker)) 
        return 
HAM_IGNORED 
        
// here, is attacker or victim?
    
if (cs_get_user_team(attacker) == CS_TEAM_CT)  {
        
g_pass[attacker] += 1
        g_xp
[attacker] += 10
    
}return PLUGIN_CONTINUE;
}

public 
logevent_round_end()
{
    for (new 
1MaxPlayers; ++i) {
        if (
cs_get_user_team(i) == CS_TEAM_T) {
            if (
is_user_alive(i)) 
                
g_block[32] +=1
            g_xp
[32] +=get_players(ctsctnum"e""CT")
        }
    }return 
PLUGIN_CONTINUE
}

public 
say_save(id

    
SaveData(id
    
client_print(idprint_center"????"


public 
say_dr(id)
    
client_print(idprint_center"????: %i ??CT??: %i ???: %i "g_pass[id], g_blockg_xp[id])

public 
client_putinserver(id)
    
LoadData(id)

public 
client_disconnect(id)
{
    
SaveData(id)
}

public 
SaveData(id
{
    new 
name[32], vaultkey[64], vaultdata[256]
    
get_user_name(idname31)
    
format(vaultkey63"%s-caxp"name)
    
format(vaultdata255"%i#%i#%i#"g_pass[id], g_block[id], g_xp[id])
    
nvault_set(g_vaultvaultkeyvaultdata)
}
public 
LoadData(id)
{
    new 
name[32], vaultkey[64], vaultdata[256]
    
get_user_name(id,name,31
    
format(vaultkey63"%s-caxp"name)
    
format(vaultdata255"%i#%i#%i#"g_pass[id], g_block[id], g_xp[id])
    
nvault_get(g_vaultvaultkeyvaultdata255
    
replace_all(vaultdata255"#"" "
    new 
playerpass[32], playerblock[32], playerxp[32]
    
parse(vaultdataplayerpass31 playerblock31 playerxp31)
    
g_pass[id] = str_to_num(playerpass)
    
g_block[id] = str_to_num(playerblock)
    
g_xp[id] = str_to_num(playerxp)

__________________




Last edited by pacheco; 07-28-2012 at 14:04.
pacheco is offline
z4a7wq
Junior Member
Join Date: Jul 2012
Old 07-29-2012 , 06:08   Re: I can't compile amxx
Reply With Quote #5

Quote:
Originally Posted by pacheco View Post
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
 
new g_xp[33
new 
g_pass[33
new 
g_block[33]
new 
g_vault
new MaxPlayers;
new 
cts[32];
new 
ctnum;
 
#define PLUGIN_NAME "deathrun"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "z4a7wq"
 
public plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR);
    
register_clcmd"say /save" ,"say_save")
    
register_clcmd"say /dr" ,"say_dr")
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink"
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled"
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
register_logevent("logevent_round_end"2"1=Round_End");
    
MaxPlayers get_maxplayers();
    
g_vault nvault_open("n_xp")
    
g_vault nvault_open("n_pass")
    
g_vault nvault_open("n_block")
 
}
 
public 
fw_PlayerKilled(victimattackershouldgib
{
    if (
attacker == victim || !is_user_connected(attacker)) 
        return 
HAM_IGNORED 
        
// here, is attacker or victim?
    
if (cs_get_user_team(attacker) == CS_TEAM_CT)  {
        
g_pass[attacker] += 1
        g_xp
[attacker] += 10
    
}return PLUGIN_CONTINUE;
}
 
public 
logevent_round_end()
{
    for (new 
1MaxPlayers; ++i) {
        if (
cs_get_user_team(i) == CS_TEAM_T) {
            if (
is_user_alive(i)) 
                
g_block[32] +=1
            g_xp
[32] +=get_players(ctsctnum"e""CT")
        }
    }return 
PLUGIN_CONTINUE
}
 
public 
say_save(id

    
SaveData(id
    
client_print(idprint_center"????"

 
public 
say_dr(id)
    
client_print(idprint_center"????: %i ??CT??: %i ???: %i "g_pass[id], g_blockg_xp[id])
 
public 
client_putinserver(id)
    
LoadData(id)
 
public 
client_disconnect(id)
{
    
SaveData(id)
}
 
public 
SaveData(id
{
    new 
name[32], vaultkey[64], vaultdata[256]
    
get_user_name(idname31)
    
format(vaultkey63"%s-caxp"name)
    
format(vaultdata255"%i#%i#%i#"g_pass[id], g_block[id], g_xp[id])
    
nvault_set(g_vaultvaultkeyvaultdata)
}
public 
LoadData(id)
{
    new 
name[32], vaultkey[64], vaultdata[256]
    
get_user_name(id,name,31
    
format(vaultkey63"%s-caxp"name)
    
format(vaultdata255"%i#%i#%i#"g_pass[id], g_block[id], g_xp[id])
    
nvault_get(g_vaultvaultkeyvaultdata255
    
replace_all(vaultdata255"#"" "
    new 
playerpass[32], playerblock[32], playerxp[32]
    
parse(vaultdataplayerpass31 playerblock31 playerxp31)
    
g_pass[id] = str_to_num(playerpass)
    
g_block[id] = str_to_num(playerblock)
    
g_xp[id] = str_to_num(playerxp)

Thx you It can compile to amxx
but have some part can't work == sorry

public logevent_round_end()
{
for (new i = 1; i < MaxPlayers; ++i) {
if (cs_get_user_team(i) == CS_TEAM_T) {
if (is_user_alive(i))
g_block[32] +=1
g_xp[32] +=get_players(cts, ctnum, "e", "CT")
}
}return PLUGIN_CONTINUE
}

At beginning , i want when round is end (ct all dead)
if t is alive = g_block +1 and g_xp + ct amount

Last edited by z4a7wq; 07-30-2012 at 07:06.
z4a7wq is offline
pacheco
Senior Member
Join Date: Jul 2011
Old 07-29-2012 , 12:35   Re: I can't compile amxx
Reply With Quote #6

Put your code with tag [php]
Sorry, but i don't know sql.
__________________




Last edited by pacheco; 07-29-2012 at 12:36.
pacheco is offline
z4a7wq
Junior Member
Join Date: Jul 2012
Old 07-30-2012 , 05:46   Re: I can't compile amxx
Reply With Quote #7

Quote:
Originally Posted by pacheco View Post
Put your code with tag [php]
Sorry, but i don't know sql.
Thank

Thx you It can compile to amxx
but have some part can't work == sorry
PHP Code:
public logevent_round_end()
{
for (new 
1MaxPlayers; ++i) {
if (
cs_get_user_team(i) == CS_TEAM_T) {
if (
is_user_alive(i)) 
g_block[32] +=1
g_xp
[32] +=get_players(ctsctnum"e""CT")
}
}return 
PLUGIN_CONTINUE

At beginning , i want when round is end (ct all dead)
if t is alive = g_block +1 and g_xp + ct amount

Last edited by z4a7wq; 07-30-2012 at 05:47.
z4a7wq 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 19:20.


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