Simple But Many Failed.
#1

Hello,
I needed to create a simple command /Warn, but i want it to save with player's statistics (/stats), And 3 Warns = Player's Account Blocked! and an administrator will have to /remwarn to remove warning from his account.
Thank You.
PS:many tried to do this, but FAILED.
Reply
#2

Edit:
Код:
new Warned[MAX_PLAYERS];
#define MAX_WARN  3
save warned and load it when player loaggedin 
and make under OnPlayerSpawn or anywhere u r loading your saved data if(Warned[playerid] == 3) { SendMessage ... Your Account Was Blocked !" } 
CMD:warn(playerid,params[])
{
	new id,reason[64];
	if(sscanf(params,"us[64]",id,reason)) SendClientMessage(playerid,-1,"Usage: /warn [id] [reason]");
	else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid,-1,"Player Not Found!");
	else
	{
	Warned[id]++;
	//Message....
        if(warn[id] == MAX_WARN)
	{
         Kick(id);
         }
	}
	return 1;
}
CMD:remwarn(playerid,params[])
{
	new id[64];
	if(sscanf(params,"u",id)) SendClientMessage(playerid,-1,"Usage: /remwarn [id] [reason]");
	else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid,-1,"Player Not Found!");
	else
	{
	Warned[id] --;
	Message ...
	}
	return 1;
}
and use Warned[playerid] in your /stats for displaying player warnings..
Reply
#3

-Bump, Its a bit urgent....
Reply
#4

Have u ever used enums?
Reply
#5

Quote:
Originally Posted by Sufyan
Посмотреть сообщение
Код:
new Warned[MAX_PLAYERS];

save warned and load it when player loaggedin 
and make under OnPlayerSpawn or anywhere u r loading your saved data if(Warned[playerid] == 3) { SendMessage ... Your Account Was Blocked !" } 
CMD:warn(playerid,params[])
{
	new id,reason[64];
	if(sscanf(params,"us[64]",id,reason)) SendClientMessage(playerid,-1,"Usage: /warn [id] [reason]");
	else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid,-1,"Player Not Found!");
	else
	{
	Warned[id]++;
	//Message....
	}
	return 1;
}
CMD:remwarn(playerid,params[])
{
	new id[64];
	if(sscanf(params,"u",id)) SendClientMessage(playerid,-1,"Usage: /remwarn [id] [reason]");
	else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid,-1,"Player Not Found!");
	else
	{
	Warned[id] --;
	Message ...
	}
	return 1;
}
and use Warned[playerid] in your /stats for displaying player warnings..
How can an administrator /remwarn when player will be offline?
Ofc, he will be offline because he will not gain access to his account after his account gets blocked, tested the code, blocked my account and then from another account when i tried to enter my id it said the player is not online?.....
atleast test the code before posting.
EDIT: @Ryder, Yes i have used 'em, And Please donot post if you cannot help,
Thank You.
Reply
#6

Quote:
Originally Posted by Littlehelper[MDZ]
Посмотреть сообщение
How can an administrator /remwarn when player will be offline?
Ofc, he will be offline because he will not gain access to his account after his account gets blocked, tested the code, blocked my account and then from another account when i tried to enter my id it said the player is not online?.....
atleast test the code before posting.
man i just give you example.. which saving sys are u using? dini? mysql?
Reply
#7

Quote:
Originally Posted by Sufyan
Посмотреть сообщение
man i just give you example.. which saving sys are u using? dini? mysql?
Currently using Y_Ini.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)