SA-MP Forums Archive
Simple But Many Failed. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Simple But Many Failed. (/showthread.php?tid=317427)



Simple But Many Failed. - Littlehelper - 11.02.2012

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.


Re: Simple But Many Failed. - Sufyan - 11.02.2012

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..



Re: Simple But Many Failed. - Littlehelper - 11.02.2012

-Bump, Its a bit urgent....


Re: Simple But Many Failed. - [HK]Ryder[AN] - 11.02.2012

Have u ever used enums?


Re: Simple But Many Failed. - Littlehelper - 11.02.2012

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.


Re: Simple But Many Failed. - Sufyan - 11.02.2012

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?


Re: Simple But Many Failed. - Littlehelper - 11.02.2012

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