Well for start (assuming you know how to include includes) I want you to download and include these 2 includes / plugins in your gamemode..
sscanf:
https://sampforum.blast.hk/showthread.php?tid=570927
Pawn.CMD:
https://sampforum.blast.hk/showthread.php?tid=608474
With these 2 plugins you can create commands.. Here's example
Code:
CMD:heal(playerid, params[]) // In this case you will have to type /heal in game for this command to work.
{
new string[128], pID, Float:Health; //We will create a new variable "pID" which will define which player id we want to heal, float variable (tag) to store player's health in and name it "Health" and "string" to format it later and sent formatted messages.
if(sscanf(params, "d", pID)) return SendClientMessage(playerid, -1, "USAGE: /heal (playerid)"); //Using "sscanf" we can check if player type "/heal" in chat, this message will pop out, letting him know he has to use /heal (playerid).
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, -1, "That player is not connected."); //Using "!IsPlayerConnected" we check if player (playerid) we are trying to heal is even connected, if not, this message will be sent and command will not be executed.
GetPlayerHealth(pID, Health); //Thats the function to get player's health
if(Health == 100) return SendClientMessage(playerid, -1, "Player is already full Health."); //With this, we check if player's health is 100, that means he doesnt need to be healed and.
SetPlayerHealth(pID, 100.0);
format(string, sizeof(string), "You have healed %s (%d).", PlayerName(pID), pID); //Formatting the message, you can checke the specifiers we use in this case on sscanf website I linked above.
SendClientMessage(playerid, -1, string); //Sending message
format(string, sizeof(string), "You have been healed by %s.", PlayerName(playerid)); //Formatting the message, you can checke the specifiers we use in this case on sscanf website I linked above.
SendClientMessage(pID, -1, string); //Sending message
return 1;
}
PlayerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
Might be complicated, but try to read the command through, and then go through "Pawn.CMD" and "sscanf" websites I linked above, and you will being to understand how it works.
Behind "//" (comment) I specified what each line does.