Hello everyone, I got few problems this time.
1. I want to know how can I get the player's current line in the nvault file and print it out with a messages.
[Prefix] You are no. X of total X.
2. How can I get the largest number of coins of the first five ppl and print it out in a MOTD?
3. Please check if any part of my code worng.
Code:
public show_coins(id)
{
new iUserName[33];
get_user_name(id, iUserName, 32);
formatex(szKey, 31, "%s-Coins", iUserName);
formatex(szData, 255, "%i", iUserCoins[id]);
nvault_get(szVault, szKey, szData, 255);
new gUserCoins[32];
parse(szData, gUserCoins, 31)
iUserCoins[id] = str_to_num(gUserCoins);
client_print_color(id, DontChange, "%s You have %i coins.", gPrefix, iUserCoins[id]);
return PLUGIN_HANDLED;
}
public EventTerrsWin()
{
new iPlayers[32], iNum;
get_players(iPlayers, iNum, "ch");
for(new i = 0; i < iNum; i++)
{
if(get_user_team(iPlayers[i]) == 1)
{
new iUserName[33];
get_user_name(iPlayers[i], iUserName, 32);
iUserCoins[iPlayers[i]] += 1;
client_print_color(0, DontChange, "%s %s gains 1 coin.", gPrefix, iUserName);
formatex(szKey, 31, "%s-Coins", iUserName);
formatex(szData, 255, "%i", iUserCoins[iPlayers[i]]);
nvault_set(szVault, szKey, szData);
client_print_color(iPlayers[i], DontChange, "%s You have %i coins.", gPrefix, iUserCoins[iPlayers[i]]);
}
}
return PLUGIN_CONTINUE;
}
Another question, can you explain the text in red means what?
Code:
public swearcheck(id)
{
new szSaid[192]
read_args(szSaid,191)
new bool:found = false
new pos, i = 0
while ( i < g_swearsNum )
{
if ( (pos = containi(szSaid,g_swearsNames[i][1])) != -1 ){
new len = g_swearsNames[i][0]
while(len--)
szSaid[pos++] = '*'
found = true
continue
}
++i
}
if ( found ){
new cmd[32]
read_argv(0,cmd,31)
engclient_cmd(id,cmd,szSaid)
}
return PLUGIN_CONTINUE
}
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others