[Tutorial] How to make a /sethours and /setkills command
#1

How to make a /SETHOURS command!


Код:
CMD:sethours(playerid, params[])
{
    if(IsPlayerAdmin(playerid) || AccInfo[playerid][Level] >= 14) (here you change level wanted of you)
    {
        new string[128];
        //----------------------------------------------------------------------
        if(sscanf(params, "ud", giveplayerid1, amount2)) return
		SendClientMessage(playerid, orange, "Usage : /sethours [playerid] [Hours]") &&
		SendClientMessage(playerid, LIGHTBLUE2, "Function: Will set the hours of a specified player!");
		//----------------------------------------------------------------------
        else if(giveplayerid1 == INVALID_PLAYER_ID) return
		SendClientMessage(playerid, red, "ERROR: Player not connected!");
		//----------------------------------------------------------------------
        else
        {
            SendCommandToAdmins(playerid, "SetHours");
            format(string, 128, "|- Administrator \"%s\" has setted your hours to %d -|", PlayerName2(playerid), amount2);
            SendClientMessage(giveplayerid1, blue, string);
			format(string, 128, "You have succesfully setted %s hours to %d!", PlayerName2(giveplayerid1), amount2);
            SendClientMessage(playerid, 0xBF993FAA, string);
            format(string, 128, "*** Administrator %s has Setted %s the ammount of hours to %d!", PlayerName2(playerid), PlayerName2(giveplayerid1), amount2);
			SaveIn("AdminLog", string);
            AccInfo[giveplayerid1][hours] = amount2;
		}
		return 1;
    }

}
HELP:

1.Just go in your server pawno , and enter in LuxAdmin,LAdmin,RAdmin ( your Admin System ) ;
2.And enter this Pawno code;



This is working just on ZCMD and SSCANF2


PHOTOS FOR /SETHOURS http://imgur.com/F4gjApd ;
http://imgur.com/NwOCfE6 ;

HOW TO MAKE /SETKILLS COMMAND:

Код:
CMD:setkills(playerid, params[])
{
    if(IsPlayerAdmin(playerid) || AccInfo[playerid][Level] >= 14) (HERE YOU PUT THE LEVEL YOU WANT OF ADMIN TO CAN USE THIS COMMAND)
    {
        new string[128];
        //----------------------------------------------------------------------
        if(sscanf(params, "ud", giveplayerid1, amount2)) return
		SendClientMessage(playerid, orange, "Usage : /setkills [playerid] [Kills]") &&
		SendClientMessage(playerid, LIGHTBLUE2, "Function: Will set the kills of a specified player!");
		//----------------------------------------------------------------------
        else if(giveplayerid1 == INVALID_PLAYER_ID) return
		SendClientMessage(playerid, red, "ERROR: Player not connected!");
		//----------------------------------------------------------------------
        else
        {
            SendCommandToAdmins(playerid, "SetKills");
            format(string, 128, "|- Administrator \"%s\" has setted your kills to %d -|", PlayerName2(playerid), amount2);
            SendClientMessage(giveplayerid1, blue, string);
			format(string, 128, "You have succesfully setted %s kills to %d!", PlayerName2(giveplayerid1), amount2);
            SendClientMessage(playerid, 0xBF993FAA, string);
            format(string, 128, "*** Administrator %s has Setted %s the ammount of kills to %d!", PlayerName2(playerid), PlayerName2(giveplayerid1), amount2);
			SaveIn("AdminLog", string);
            AccInfo[giveplayerid1][Kills] = amount2;
		}
		return 1;
    }

}
PHOTOS FOR /SETKILLS :
http://imgur.com/kxxf814
http://imgur.com/HJqbaIf


/SETKILLS HELP :

Код:
 format(string, 128, "|- Administrator \"%s\" has setted your kills to %d -|", PlayerName2(playerid), amount2);--> This will show to the player who you will give hours !
--> This will show to the player who you will give hours !
Код:
|- Administrator \"%s\" has setted your kills to %d -|
and

Код:
	format(string, 128, "You have succesfully setted %s kills to %d!", PlayerName2(giveplayerid1), amount2);--> This will show to the Admin who gave kills
--> This will show to the Admin who gave kills
Код:
You have succesfully setted %s kills to %d!
where %s = player and %d = kills

and

Код:
            format(string, 128, "*** Administrator %s has Setted %s the ammount of kills to %d!", PlayerName2(playerid), PlayerName2(giveplayerid1), amount2);--> This will show to all players and admins in chat!
--> This will show to all players and admins in chat!
Код:
*** Administrator %s has Setted %s the ammount of kills to %d
where %s = player and %d = kills !
and

Код:
 if(IsPlayerAdmin(playerid) || AccInfo[playerid][Level] >= 14) -- HERE YOU PUT THE LEVEL YOU WANT OF ADMIN TO CAN USE THIS COMMAND ! You will change 14 to what level do you want!
--HERE YOU PUT THE LEVEL YOU WANT OF ADMIN TO CAN USE THIS COMMAND ! You will change 14 to what level do you want!

This commands will be saved in
Код:
SaveIn("AdminLog", string);
, AdminLog in your server!


/SETHOURS HELP:

Код:
 if(IsPlayerAdmin(playerid) || AccInfo[playerid][Level] >= 14)
--> Just Admins level 14 can use this command , so you can change 14 to what level do you want !
Код:
 >= 14) -- you can change 14 to what level do you want
--> Just Admins level 14 can use this command , so you can change 14 to what level do you want ! [code] >= 14)

and

Код:
format(string, 128, "|- Administrator \"%s\" has setted your hours to %d -|", PlayerName2(playerid),amount2);----> This will show to player who you gave him hours in chat!
----> This will show to player who you gave him hours in chat!
Код:
|- Administrator \"%s\" has setted your hours to %d -|
where %s = player and %d = hours

and


Код:
format(string, 128, "You have succesfully setted %s hours to %d!", PlayerName2(giveplayerid1), amount2);--> This will show to Admin who gave to a player hours in chat !
--> This will show to Admin who gave to a player hours in chat !
Код:
You have succesfully setted %s hours to %d!
but %s and %d will change ! %s = player and %d = hours !

and

Код:
format(string, 128, "*** Administrator %s has Setted %s the ammount of hours to %d!",PlayerName2(playerid), PlayerName2(giveplayerid1), amount2); --> This will show to all players in chat!
--> This will show to all players in chat!
Код:
*** Administrator %s has Setted %s the ammount of hours to %d!
where %s = player and %d = hours




This is working just in sscanf2 and zcmd ;











BUGS:
I didn.t find bugs , if you find , send me , and I will solve in other update!







I hope you will enjoy this !
Reply
#2

Not a really bad tutorial, you made some efforts.
However, you have some mistakes.
First,
pawn Код:
CMD:sekills(playerid, params[]) should be:
CMD:setkills(playerid, params[])
Next,This is just a code. I don't see any tutorial here, just a script to be c/p and edited. New scripters are looking to learn, not c/p stuff. Edit the tutorial and explain what each line of code and I'll be happy.
Reply
#3

I edited him , I hope so to be good now , sorry for my bad english , but I think you are understanding me !
Reply
#4

There goes your first reputation
Keep up the good job
Reply
#5

Thanks !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)