How To >>> - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Server (
https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (
https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: How To >>> (
/showthread.php?tid=546130)
How To >>> -
Seaf - 13.11.2014
How to create a Commnd ! Any Tutiorl or Some one tell me like ? cmd;dance or some thing just simple thing ! +rep
Re: How To >>> -
Banana_Ghost - 13.11.2014
This Is Using ZCMD and sscanf.
pawn Код:
CMD:dance(playerid,params[])
{
new dancestyle; //defining this so that it can be used below.
if(sscanf(params, "d", dancestyle)) return SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3); //Parameters Used With This Command. If None Are Specified, The Player Will Use Dance 3.
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"You Cannot Use This Command In A Vehicle."); //Vehicle Protection So That You Cannot Use This Animation While In A Vehicle.
else
{
if(dancestyle == 1) //Defining the different dance style options.
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE1);
SendClientMessage(playerid, -1,"You Are Now Dancing. Press Any Key To Stop.");
}
else if(dancestyle == 2)
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE2);
SendClientMessage(playerid, -1,"You Are Now Dancing. Press Any Key To Stop.");
}
else if(dancestyle == 3)
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3);
SendClientMessage(playerid, -1,"You Are Now Dancing. Press Any Key To Stop.");
}
else if(dancestyle == 4)
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE4);
SendClientMessage(playerid, -1,"You Are Now Dancing. Press Any Key To Stop.");
}
}
return 1;
}
Re: How To >>> -
Seaf - 13.11.2014
you created it all i didnt under stand any thing i need how to make cmd
Need Tutiorl
Re: How To >>> -
ZaBraNjeNi - 13.11.2014
See here:
-
https://sampforum.blast.hk/showthread.php?tid=375747
Re: How To >>> -
CoaPsyFactor - 13.11.2014
Let me try
pawn Код:
CMD:dance(playerid,params[])
{
new dancestyle; //defining this so that it can be used below.
// parse params to get which Id did player entered
if(sscanf(params, "d", dancestyle)) {
//Parameters Used With This Command. If None Are Specified, The Player Will Use Dance 3.
return SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3);
}
if(IsPlayerInAnyVehicle(playerid)) {
//Vehicle Protection So That You Cannot Use This Animation While In A Vehicle.
return SendClientMessage(playerid,-1,"You Cannot Use This Command In A Vehicle.");
}
// switch through inserted style
// and assign action to variable
switch (dancestyle) {
case 1: {
dancestyle = SPECIAL_ACTION_DANCE1;
}
case 2: {
dancestyle = SPECIAL_ACTION_DANCE2;
}
case 3: {
dancestyle = SPECIAL_ACTION_DANCE3;
}
case 4: {
dancestyle = SPECIAL_ACTION_DANCE4;
}
default: {
// In case that imported value is not listed show this
return SendClientMessage(playerid, -1, "Wrong value");
}
}
// set player special action with dancestyle variable
SetPlayerSpecialAction(playerid, dancestyle);
// show message
SendClientMessage(playerid, -1,"You Are Now Dancing. Press Any Key To Stop.");
return 1;
}
Re: How To >>> -
AzaMx - 16.11.2014
pawn Код:
//Easy function for commands.
stock SCP(_id, _param[], _command[] = "")
{
format(iStr, sizeof(iStr), "{6a696a}[Command]: /%s {9c9a9c}%s", _command, _param); //If you type /dance and enter, it will return like that message.
return SendMessageToPlayer(_id, COLOR_LIGHTGREY, iStr, 128); //Messages colors
}
COMMAND:dance(playerid, params[]) //Command, you require zcmd includes for this.
{
new id;
if(sscanf(params, "d", id)) return SCP(playerid, "[1-4]"); //You have to choice the number of Dance Styles.
switch(id)
{
case 1: SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE1); //Dance Styles 1
case 2: SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE2); //Dance Styles 2
case 3: SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3); //Dance Styles 3
case 4: SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE4); //Dance Styles 4
default: SCP(playerid, "[1-4]"); //If you put the wrong action for dance, example "/dance 5" and it will be return to "[Commands]: /dance [1-4]"
}
return 1;
}