[Tutorial] Basic Admins Commands
#1

Basic Admins Commands
This is my first tutorial i decided to make it to help newbies in scripting and making admin commands

First:
Slap

We use this command to put the player a few meters above in the sky to decrease their health

PHP код:
CMD:slap(playeridparams[])
{
if(
PlayerInfo[playerid][pAdmin] != 0)
{
new 
targetid;
new 
Float:xFloat:yFloat:z;
GetPlayerPos(targetidxyz); 
if(
sscanf(params,"u"targetid)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /slap [id]"); 
if(!
IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_RED"This player is not connected"); 
SetPlayerPos(targetidxyz+5);
}
else
{
SendClientMessage(playeridCOLOR_RED"You can't use this command"); 
}
return 
1;

Now for the explain:

PHP код:
if(PlayerInfo[playerid][pAdmin] != 0// this line check if the admin level of the player that saves in the player file if it != "not equal" 0 run the command. 
PHP код:
new targetid//this define the variable that will store the target id that the player write. 
PHP код:
new Float:xFloat:yFloat:z//define the varable to get the player pos. 
PHP код:
if(sscanf(params,"u"targetid)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /slap [id]"); //in this line we check if the player write the command rightor not if he typed /slap only it will send him a message tell him the right usage. 
PHP код:
if(!IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_RED"This player is not connected");//this check if the targetid that the player typed is connect or not and if not send him a message . 
PHP код:
SetPlayerPos(targetidxyz+5); //This is the aim of the command to set the player pos "That  we get it before and stored it" and add to it 5 meter "z = the height of the player". 
PHP код:
}
else 
//if the player doesn't have the perimission:

PHP код:
SendClientMessage(playeridCOLOR_RED"You can't use this command");  //Send to him a message and return 1 at the end of the command.
}
return 
1;


Second:
Sethp
We use this command to set a player's health
PHP код:
CMD:sethp(playeridparams[])
{
new 
targetid//as explained above
new amount//to store the amount of the health
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playeridCOLOR_RED"You can't use this command"); //Another way to give the player the perimission
if(sscanf(params"ui"targetidamount)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /sethp [id] (amount)"); //as explained above
if(!IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_RED"This player is not connected"); //as explained above
SetPlayerHealth(targetidamount); //set the targetid health with the amount of the admin typed
SendClientMessage(targetidCOLOR_GREEN"An admin changed your health"); //Send a message to the target id that there is an admin changed his health
return 1;

Third:
akill

We use this command to kill a player
PHP код:
CMD:akill(playeridparams[])
{
ew targetid;
if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playeridCOLOR_RED"You can't use this command"); //As explained above
if(!IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_RED"This player is not connected"); //As explained above
if(sscanf(params"u"targetid)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /akill [id]"); //As explained above
SetPlayerHealth(targetid0); //Set the player health to 0 "Kill him"
SendClientMessage(targetidCOLOR_GREEN"An admin killed you");
return 
1;

Fourth:
SetArmour
To set a player armour
PHP код:
CMD:setarmour(playeridparams[])
{
new 
targetid//As explained at the very above :D
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playeridCOLOR_RED"You can't use this command"); //As explained above
if(sscanf(params"u"targetid)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /setarmour [id]");//As explained above
if(!IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_RED"This player is not connected");//As explained above
SetPlayerArmour(targetid100.0); //Give him a full armour level
SendClientMessage(targetidCOLOR_GREEN"An admin added an armour to you");
return 
1;

Fifth:
Freeze
We use this command to prevent the player from move or do anything

All as explained above ecxept the things that i will explain
PHP код:
CMD:freeze(playeridparams[])
{
new 
targetid;
if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playeridCOLOR_RED"You can't use this command");
if(
sscanf(params"u"targetid)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /freeze [id]");
if(!
IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_RED"This player is not connected");
TogglePlayerControllable(targetid,0);//This prevent the player from control his body in the game
return 1;

Sixth:
Unfreeze
We use this command to unfreeze the player
All as above ecxept
PHP код:
TogglePlayerControllable(targetid,0); 
Will be
PHP код:
TogglePlayerControllable(targetid,1); 
Seventh:
GiveMoney
We use this command to give the player an amount of money
PHP код:
CMD:givecash(playeridparams[])
{
new 
targetid;
new 
amount;
if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playeridCOLOR_RED"You can't use this command");
if(
sscanf(params"ui"targetidamount)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /givecash [id] (amount)");
if(!
IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_RED"This player is not connected");
GivePlayerMoney(targetidamount); //Give the player an amount of money that the admin typed
SendClientMessage(targetidCOLOR_GREEN"An admin gave you money");
return 
1;

End of the tutorial hope that it will helped you.
Ahmed_Nezoo
Reply
#2

So so, simple...
Reply
#3

These do nothing:
Reply
#4

Quote:
Originally Posted by nogh445
Посмотреть сообщение
These do nothing:
These Add armour to the player and the other freeze him !!
Reply
#5

1 Question will make you Famous ?
Whats new ?
Reply
#6

Quote:

This is my first tutorial i decided to make it to help newbies in scripting and making admin commands

!!!!!!
Reply
#7

This isn't really helping your just teaching the newbie how to copy and paste, make some lessons how to do that "Basic Admin Commands" instead of pasting a fully scripted codes give then a lessons.

EDIT: those are really basic.
Reply
#8

It's not a tutorial is just a basic filterscript
Reply
#9

Quote:
Originally Posted by nezo2001
Посмотреть сообщение
These Add armour to the player and the other freeze him !!
Where's the command though? /setarmour, /freeze. You didnt add the ZCMD commands in.

ex:
pawn Код:
CMD:setarmour(playerid, params[])
Get what im sayin? :P
Reply
#10

lol Sorry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)