Originally Posted by Excalibur.007
(Post 1493262)
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_bitConnectedPlayers, g_bitAlivePlayers, g_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(szMessage, 191)
remove_quotes(szMessage)
get_user_name(id, szName, 31)
if(!is_valid_msg(szMessage))
return PLUGIN_CONTINUE
if(IsUserAlive(id))
format(szMessage, 191, "^4[%s] ^3%s : ^1%s", RANKS[iRank[id]], szName, szMessage)
else
format(szMessage, 191, "^1*DEAD* ^4[%s] ^3%s : ^1%s", RANKS[iRank[id]], szName, szMessage)
for(new i = 1; i <= g_iMaxPlayers; i++)
{
if(IsUserConnected(i))
{
if(IsUserAlive(id) && IsUserAlive(i) || !is_user_alive(id) && !is_user_alive(i))
{
message_begin(MSG_ONE, g_msgSayText, {0, 0, 0}, i)
write_byte(id)
write_string(szMessage)
message_end()
}
}
}
return PLUGIN_CONTINUE
}
public hook_say_team(id)
{
new szMessage[192], szName[32]
read_args(szMessage, 191)
remove_quotes(szMessage)
get_user_name(id, szName, 31)
if(!is_valid_msg(szMessage))
return PLUGIN_HANDLED_MAIN
if(IsUserAlive(id))
format(szMessage, 191, "^4[%s] ^3%s : ^1%s", RANKS[iRank[id]], szName, szMessage)
else
format(szMessage, 191, "^1*DEAD* ^4[%s] ^3%s : ^1%s", RANKS[iRank[id]], szName, szMessage)
for(new i = 1; i <= g_iMaxPlayers; i++)
{
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_ONE, g_msgSayText, {0, 0, 0}, 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 iVictim; iVictim = read_data(1)
static iKiller; iKiller = read_data(2)
static iIsHeadshot; iIsHeadshot = 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)
|