SA-MP Forums Archive
How to make a 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)
+--- Thread: How to make a command (/showthread.php?tid=575240)



How to make a command - 7Ahmad7 - 24.05.2015

Hey guys,I want to make a command which can set the player's skin (by the whole player ,no admin staff)
How to make that using ZCMD? and where can i get it's last update?(the zcmd)


Re: How to make a command - AlonzoTorres - 25.05.2015

I would recommend Y_CMD over zcmd. It has very similar syntax. If you can migrate to this system I have tutorials on it (see signature). https://sampforum.blast.hk/showthread.php?tid=571047


Re: How to make a command - Abagail - 25.05.2015

He isn't asking for anything else, he is asking for Z-CMD. You shouldn't be advertising includes when he is asking for something he wants, not asking for something else.

You can find Z-CMD here:
http://pastebin.com/2qdq8MTN

And as for the command:

pawn Код:
CMD:setmyskin(playerid, params[])
{
      new skin = strval(params);
      if(skin < 0 || skin > 311) return SendClientMessage(playerid, -1, "Invalid skin!");

      SetPlayerSkin(playerid, skin);
      return 1;
}



Re: How to make a command - 7Ahmad7 - 25.05.2015

Another small question:

I made a PlayerPlaySound when a player joins the server,how to stop it after the player spawn?


Re: How to make a command - SickAttack - 25.05.2015

Quote:
Originally Posted by 7Ahmad7
Посмотреть сообщение
Another small question:

I made a PlayerPlaySound when a player joins the server,how to stop it after the player spawn?
Play the sound that stops it if the should being played is a song-type sound.

BEE_TRACK_SOUND:

Play:
pawn Код:
PlayerPlaySound(playerid,1076,0.0,0.0,0.0);
Stop:
pawn Код:
PlayerPlaySound(playerid,1077,0.0,0.0,0.0);



Re: How to make a command - Yashas - 25.05.2015

I have an updated version of ZCMD here
https://sampforum.blast.hk/showthread.php?pid=3468241#pid3468241

I-ZCMD works like ZCMD.The only change is in performance.I-ZCMD is twice as fast as ZCMD and thrice as fast as y_commands.

EDIT:Fixed the code.Thanks Abagail
Код:
COMMAND:setskin(playerid,params[])
{
      new skinid;
      if(sscanf(params,"i",skinid)) SendClientMessage(playerid,"Usage:/setskin [skinid]");
      else ifif(skin < 0 || skin > 311) return SendClientMessage(playerid, -1, "Invalid skin!");
      else SetPlayerSkin(playerid, skin);
      return 1;
}



Re: How to make a command - Abagail - 25.05.2015

You need to check if the skin is valid(0-311) or not or else it will set to CJ skin and or crash(it seems it sets to CJ instead of crashing in the RC versions -> haven't tested on the final release)


Re: How to make a command - 7Ahmad7 - 25.05.2015

Guys,ther eis some errors on that code,My fixed code :
pawn Код:
CMD:skin(playerid,params[])
{
      new skinid;
      if(sscanf(params,"i",skinid)) SendClientMessage(playerid,"Usage:/setskin [skinid]");
      else if(skinid < 0 || skinid > 311) return SendClientMessage(playerid, -1, "Invalid skin!");
      else SetPlayerSkin(playerid, skinid);
      return 1;
}
And i fixed 4 errors,still got 2:
D:\Programmes\Engabic Blood Server\gamemodes\EABS.pwn(393) : error 017: undefined symbol "sscanf"
D:\Programmes\Engabic Blood Server\gamemodes\EABS.pwn(393) : error 035: argument type mismatch (argument 2)


Re: How to make a command - Ghazal - 25.05.2015

Quote:
Originally Posted by 7Ahmad7
Посмотреть сообщение
Guys,ther eis some errors on that code,My fixed code :
pawn Код:
CMD:skin(playerid,params[])
{
      new skinid;
      if(sscanf(params,"i",skinid)) SendClientMessage(playerid,"Usage:/setskin [skinid]");
      else if(skinid < 0 || skinid > 311) return SendClientMessage(playerid, -1, "Invalid skin!");
      else SetPlayerSkin(playerid, skinid);
      return 1;
}
And i fixed 4 errors,still got 2:
D:\Programmes\Engabic Blood Server\gamemodes\EABS.pwn(393) : error 017: undefined symbol "sscanf"
D:\Programmes\Engabic Blood Server\gamemodes\EABS.pwn(393) : error 035: argument type mismatch (argument 2)
Download sscanf include and add this line in top of your gamemode.

pawn Код:
#include <sscanf>
sscanf link: https://dl.dropboxusercontent.com/u/...canf-2.8.2.zip

Don't also forget to put it in plugins.


Re: How to make a command - 7Ahmad7 - 25.05.2015

Now i have got the error 035:argument type mismatch on he same code above(that is the line
pawn Код:
if(sscanf(params,"i",skinid)) SendClientMessage(playerid,"Usage:/setskin [skinid]");