Raised This Month: $ Target: $400
 0% 

[SOLVED]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-23-2011 , 08:48   Re: [SOLVED]
Reply With Quote #7

Quote:
Originally Posted by Excalibur.007 View Post
2 problems

PHP Code:
new const RANKS[] =
{
"Unranked"// 0
"Private"// 1
"Private 1st Class"// 2
"Corporal"// 3
"Sergeant"// 4
"Staff Sergeant"// 5
"Sergeant 1st Class"// 6
"Master Sergeant"// 7
"Sergeant Major"// 8
"2nd Lieutenant"// 9
"1st Lieutenant"// 10
"Captain"// 11
"Major"// 12
"Lieutenant Colonel"// 13
"Colonel"// 14
"Brigadier General"// 15
"Major General"// 16
"Lieutenant General"// 17
"General"// 18
"General of the Army" // 19
}

new const 
EXP[] =
{
0// 0
0// 1
50// 2
100// 3
200// 4
400// 5
800// 6
1600// 7
3200// 8
6400// 9
12800// 10
25600// 11
51200// 12
102400// 13
204800// 14
409600// 15
819200// 16
1638400// 17
3276800// 18
6553600 // 19
}

new 
g_bitConnectedPlayersg_bitAlivePlayersg_bitZombiePlayers

#define MarkUserConnected(%0) g_bitConnectedPlayers |= (1 << (%0 & 31))
#define ClearUserConnected(%0) g_bitConnectedPlayers &= ~(1 << (%0 & 31))
#define IsUserConnected(%0) g_bitConnectedPlayers & (1 << (%0 & 31))

#define MarkUserAlive(%0) g_bitAlivePlayers |= (1 << (%0 & 31))
#define ClearUserAlive(%0) g_bitAlivePlayers &= ~(1 << (%0 & 31))
#define IsUserAlive(%0) g_bitAlivePlayers & (1 << (%0 & 31))

#define MarkUserZombie(%0) g_bitZombiePlayers |= (1 << (%0 & 31))
#define ClearUserZombie(%0) g_bitZombiePlayers &= ~(1 << (%0 & 31))
#define IsUserZombie(%0) g_bitZombiePlayers & (1 << (%0 & 31))

public plugin_init()
{
register_clcmd("say""hook_say")
register_clcmd("say_team""hook_say_team")
}

public 
hook_say(id)
{
new 
szMessage[192], szName[32]

read_args(szMessage191)
remove_quotes(szMessage)
get_user_name(idszName31)

if(!
is_valid_msg(szMessage))
return 
PLUGIN_CONTINUE

if(IsUserAlive(id))
format(szMessage191"^4[%s] ^3%s : ^1%s"RANKS[iRank[id]], szNameszMessage)
else
format(szMessage191"^1*DEAD* ^4[%s] ^3%s : ^1%s"RANKS[iRank[id]], szNameszMessage)

for(new 
1<= g_iMaxPlayersi++)
{
if(
IsUserConnected(i))
{
if(
IsUserAlive(id) && IsUserAlive(i) || !is_user_alive(id) && !is_user_alive(i))
{
message_begin(MSG_ONEg_msgSayText, {000}, i)
write_byte(id)
write_string(szMessage)
message_end()
}
}
}
return 
PLUGIN_CONTINUE
}

public 
hook_say_team(id)
{
new 
szMessage[192], szName[32]

read_args(szMessage191)
remove_quotes(szMessage)
get_user_name(idszName31)

if(!
is_valid_msg(szMessage))
return 
PLUGIN_HANDLED_MAIN

if(IsUserAlive(id))
format(szMessage191"^4[%s] ^3%s : ^1%s"RANKS[iRank[id]], szNameszMessage)
else
format(szMessage191"^1*DEAD* ^4[%s] ^3%s : ^1%s"RANKS[iRank[id]], szNameszMessage)

for(new 
1<= g_iMaxPlayersi++)
{
if(
IsUserConnected(i))
{
new 
teamid get_user_team(id)
new 
teami get_user_team(i)

if(
IsUserAlive(id) && IsUserAlive(i) && teamid == teami || !is_user_alive(id) && !is_user_alive(i) && teamid == teami)
{
message_begin(MSG_ONEg_msgSayText, {000}, i)
write_byte(id)
write_string(szMessage)
message_end()
}
}
}
return 
PLUGIN_CONTINUE

1. This shows nranked when it supposed to be Private when iRank[id] == 1

PHP Code:
public event_DeathMsg()
{
static 
iVictimiVictim read_data(1)
static 
iKilleriKiller read_data(2)
static 
iIsHeadshotiIsHeadshot read_data(3)

ClearUserAlive(iVictim)

if(
iVictim == iKiller || IsUserZombie(iKiller) || iRank[iKiller] == 0)
return 
HAM_IGNORED

if(IsUserLoggedIn(iKiller))
{
if(
IsUserZombie(iVictim))
{
if(
iIsHeadshot)
iXP[iKiller] += cached_hsxp
else
iXP[iKiller] += cached_xp

if(iXP[iKiller] >= EXP[iRank[iKiller]] && iRank[iKiller] < 19)
{
iRank[iKiller]++

client_printcolor(iKiller"/g[ZP Ranks] /yCongratulations, your rank is now %s"RANKS[iRank[iKiller]])
}
}
}
return 
HAM_IGNORED

2. Doesn't add the XP to the players. Oh and iRank[id] == 0 is when the player isn't registered into the database so that he doesn't gets XP until he registers into the database.

It will automatically sets iRank[id] to 1 when the player registers into the server successfully. But when I type, it shows Nranked when it supposed to be Private. I've checked in the .ini file (Includes all the password for the plugin) It saves the password correctly and works perfectly. I've check also the nVault using nVault Reader. It saves the rank and xp correctly.

Problems:
- It shows [Nranked] *Player's name* : *Message* when it supposed to be private.
- XP doesn't adds even iRank[id] is set to 1. (If it's 0, it will disable that particular player from getting XP)
Don't remove your post after being helped.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 23:33.


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