Raised This Month: $ Target: $400
 0% 

String not printing properly.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
P1raten
Senior Member
Join Date: Feb 2010
Old 02-06-2013 , 17:25   String not printing properly.
Reply With Quote #1

On client_authorized i use the copy function to assign a weapon to a global variable with id as key.

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fun>
#include <hamsandwich>

new g_iWep[33];
new 
g_iAmmo[33];

new const 
Weapon[][] =
{
    
"weapon_glock18",
    
"weapon_usp",
    
"weapon_p228",
    
"weapon_deagle",
    
"weapon_fiveseven",
    
"weapon_elite"
};

new const 
Ammo[][] =
{
    
"ammo_9mm",
    
"ammo_45acp",
    
"ammo_357sig",
    
"ammo_50ae",
    
"ammo_57mm"
};

public 
plugin_init()
{
    
register_plugin(PluginVersionAuthor);

    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1);
}
{...}
public 
client_authorized(id)
{
    
copy(g_iWep[id], charsmax(g_iWep), Weapon[0]);
    
copy(g_iAmmo[id], charsmax(g_iAmmo), Ammo[0]);
}
{...}
public 
fwHamPlayerSpawnPost(iPlayer)
{
    if (
is_user_alive(iPlayer))
    {
        
give_item(iPlayerg_iWep[iPlayer]);
        
give_item(iPlayerg_iAmmo[iPlayer]);
    }
}
{...} 
If i print this in the same function then it displays properly as "weapon_glock18". Which is what I desire.

However, when trying to give the weapon to a player it does not always work.

I printed out in the server the player id and the weapon.

PHP Code:
Player ID(Wepwweapon_glock18)
Player ID(Wepweapon_glock18)
Player ID(Wepwweapon_glock18)
Player ID(Wepweapon_glock18)
Player ID(Wepweapon_glock18)
Player ID(Wepweapon_glock18)
Player ID(Wepeapon_glock18)
Player ID(Wepweapon_glock18)
Player ID(Wepeapon_glock18
__________________
No salvation. Only madness.
P1raten is offline
 



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 20:36.


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