SA-MP Forums Archive
[Tutorial] Making /setarmour command - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Making /setarmour command (/showthread.php?tid=548017)



Making /setarmour command - Trollerz - 27.11.2014

OK I'll do it fast

Open Pawno>Hit ctrl+n

ADD
Code:
#include <a_samp>
#include <zcmd>
now scroll down at last
we gonna make the cmd

now type

Code:
CMD:setarmour(playerid,params)
{
SetPlayerArmour(playerid, 100);
SendClientMessage(playerid, COLOR_YELLOW, "You have been given armour");
return 1;
}
ok so,
SendClientMessage will be the message which the player will get after he types /setarmour
and u need zcmd include...!
and be carefull that the first word of commandmust be capital
example
(S)end©lient(M)essage
and
setplayerarmour will set armour after you type /setarmour
TUT
Done
Bye


Re: Making /setarmour command - Jonggol - 27.11.2014

Simple Totorial, but Good job!


Re: Making /setarmour command - Trollerz - 27.11.2014

Thank you


Re: Making /setarmour command - SydthTV - 27.11.2014

If you want to create such a simple tutorial, at least put some effort and explanation into making it.


Re: Making /setarmour command - Trollerz - 27.11.2014

BUMP....!
Its too easy that it dont need much info


Re: Making /setarmour command - PedexM - 27.11.2014

You don't use Params why put? Look (with params):
pawn Code:
CMD:setarmour(playerid, params)
{
    new id, armour;
    if(sscanf(params, "ui", id, armour)) return SendClientMessage(playerid, "[USE]: /setarmour [ID] [ARMOUR]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, "Player don't Connected");
    if(armour > 0 || armour < 100) return SendClientMessage(playerid, "Use numbers 0-100");
    SetPlayerArmour(id, armour);
    new Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME], String[128];
    GetPlayerName(playerid, Name1, sizeof(Name1));
    GetPlayerName(id, Name2, sizeof(Name2));
    format(String, sizeof(String), "The Admin %s set armour %i of %s ",Name1, Armour, Name2);
    SendClientMessageToAll(-1, String);
    return 1;
}
much better, Sorry for my bad english, I am Brazilian.


Re: Making /setarmour command - Remba031 - 13.12.2014

Quote:
Originally Posted by PedexM
View Post
You don't use Params why put? Look (with params):
pawn Code:
CMD:setarmour(playerid, params)
{
    new id, armour;
    if(sscanf(params, "ui", id, armour)) return SendClientMessage(playerid, "[USE]: /setarmour [ID] [ARMOUR]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, "Player don't Connected");
    if(armour > 0 || armour < 100) return SendClientMessage(playerid, "Use numbers 0-100");
    SetPlayerArmour(id, armour);
    new Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME], String[128];
    GetPlayerName(playerid, Name1, sizeof(Name1));
    GetPlayerName(id, Name2, sizeof(Name2));
    format(String, sizeof(String), "The Admin %s set armour %i of %s ",Name1, Armour, Name2);
    SendClientMessageToAll(-1, String);
    return 1;
}
much better, Sorry for my bad english, I am Brazilian.
Code:
CMD:setarmour(playerid, params)
{
    if(IsPlayerAdmin(playerid))
    {
         new id, armour;
         if(sscanf(params, "ui", id, armour)) return SendClientMessage(playerid, "[USE]: /setarmour [ID] [ARMOUR]");
         if(!IsPlayerConnected(id)) return SendClientMessage(playerid, "Player don't Connected");
         if(armour > 0 || armour < 100) return SendClientMessage(playerid, "Use numbers 0-100");
         SetPlayerArmour(id, armour);
         new Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME], String[128];
         GetPlayerName(playerid, Name1, sizeof(Name1));
         GetPlayerName(id, Name2, sizeof(Name2));
         format(String, sizeof(String), "The Admin %s set armour %i of %s ",Name1, Armour, Name2);
         SendClientMessageToAll(-1, String);
         return 1;
    }
    else
    {
         SendClientMessage(playerid,-1,"SERVER: You are not logged in to RCON.");
    }
    return 1;
}



Re: Making /setarmour command - PedexM - 13.12.2014

Quote:
Originally Posted by Remba031
View Post
Code:
CMD:setarmour(playerid, params)
{
    if(IsPlayerAdmin(playerid))
    {
         new id, armour;
         if(sscanf(params, "ui", id, armour)) return SendClientMessage(playerid, "[USE]: /setarmour [ID] [ARMOUR]");
         if(!IsPlayerConnected(id)) return SendClientMessage(playerid, "Player don't Connected");
         if(armour > 0 || armour < 100) return SendClientMessage(playerid, "Use numbers 0-100");
         SetPlayerArmour(id, armour);
         new Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME], String[128];
         GetPlayerName(playerid, Name1, sizeof(Name1));
         GetPlayerName(id, Name2, sizeof(Name2));
         format(String, sizeof(String), "The Admin %s set armour %i of %s ",Name1, Armour, Name2);
         SendClientMessageToAll(-1, String);
         return 1;
    }
    else
    {
         SendClientMessage(playerid,-1,"SERVER: You are not logged in to RCON.");
    }
    return 1;
}
pawn Code:
CMD:setarmour(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERROR]: You don't have permission");
    new id, armour, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME], String[128];
    if(sscanf(params, "ui", id, armour)) return SendClientMessage(playerid, "[USE]: /setarmour [ID] [ARMOUR]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, "Player don't Connected");
    if(armour > 0 || armour < 100) return SendClientMessage(playerid, "Use numbers 0-100");
    SetPlayerArmour(id, armour);
    GetPlayerName(playerid, Name1, sizeof(Name1));
    GetPlayerName(id, Name2, sizeof(Name2));
    format(String, sizeof(String), "The Admin %s set armour %i of %s ",Name1, Armour, Name2);
    SendClientMessageToAll(-1, String);
    return 1;
}



Re: Making /setarmour command - Glossy42O - 13.12.2014

Can be abused..