CMD:slap(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] != 0)
{
new targetid;
new Float:x, Float:y, Float:z;
GetPlayerPos(targetid, x, y, z);
if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /slap [id]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
SetPlayerPos(targetid, x, y, z+5);
}
else
{
SendClientMessage(playerid, COLOR_RED, "You can't use this command");
}
return 1;
}
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.
new targetid; //this define the variable that will store the target id that the player write.
new Float:x, Float:y, Float:z; //define the varable to get the player pos.
if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, COLOR_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.
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_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 .
SetPlayerPos(targetid, x, y, z+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".
}
else //if the player doesn't have the perimission:
{
SendClientMessage(playerid, COLOR_RED, "You can't use this command"); //Send to him a message and return 1 at the end of the command.
}
return 1;
}
CMD:sethp(playerid, params[])
{
new targetid; //as explained above
new amount; //to store the amount of the health
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "You can't use this command"); //Another way to give the player the perimission
if(sscanf(params, "ui", targetid, amount)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /sethp [id] (amount)"); //as explained above
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected"); //as explained above
SetPlayerHealth(targetid, amount); //set the targetid health with the amount of the admin typed
SendClientMessage(targetid, COLOR_GREEN, "An admin changed your health"); //Send a message to the target id that there is an admin changed his health
return 1;
}
CMD:akill(playerid, params[])
{
ew targetid;
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "You can't use this command"); //As explained above
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected"); //As explained above
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /akill [id]"); //As explained above
SetPlayerHealth(targetid, 0); //Set the player health to 0 "Kill him"
SendClientMessage(targetid, COLOR_GREEN, "An admin killed you");
return 1;
}
CMD:setarmour(playerid, params[])
{
new targetid; //As explained at the very above :D
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "You can't use this command"); //As explained above
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setarmour [id]");//As explained above
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");//As explained above
SetPlayerArmour(targetid, 100.0); //Give him a full armour level
SendClientMessage(targetid, COLOR_GREEN, "An admin added an armour to you");
return 1;
}
CMD:freeze(playerid, params[])
{
new targetid;
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "You can't use this command");
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /freeze [id]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
TogglePlayerControllable(targetid,0);//This prevent the player from control his body in the game
return 1;
}
TogglePlayerControllable(targetid,0);
TogglePlayerControllable(targetid,1);
CMD:givecash(playerid, params[])
{
new targetid;
new amount;
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "You can't use this command");
if(sscanf(params, "ui", targetid, amount)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /givecash [id] (amount)");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
GivePlayerMoney(targetid, amount); //Give the player an amount of money that the admin typed
SendClientMessage(targetid, COLOR_GREEN, "An admin gave you money");
return 1;
}
This is my first tutorial i decided to make it to help newbies in scripting and making admin commands |
CMD:setarmour(playerid, params[])