Basic Commands to scrpit
#1

Can anyone write some basic commands for a server?
like /heal /run or /skin [ID]
I am very unexperienced
and if you go like ''Go to SAMP wiki or learn the turitorial'' just ignore this thread
ugh,I am just seeking some scripting help
*PM me if you are an experienced scripter,I have lots of ideas
Reply
#2

Quote:

and if you go like ''Go to SAMP wiki or learn the turitorial'' just ignore this thread

so what are we supposed to do? i don't think anybody here is going to make you a private tutorial about something that has been on this forum hundreds of times. :P
there's a pretty nice tutorial on sa-mp wiki, everything is explained.
https://sampwiki.blast.hk/wiki/Fast_Commands
Reply
#3

I personally recommend IZCMD and SSCANF for creating any type of commands. Example with IZCMD/ZCMD for heal command and skin command.

Quote:

CMD:heal(playerid, params[]) //Creating the command via ZCMD.
{
SetPlayerHealth(playerid, 100); //Setting his health to 100, which is filling the bar fully.
SendClientMessage(playerid, -1, "You have been healed."); //Telling the player that we have done it.
return 1; //Returning 1, telling the ZCMD/IZCMD include that everything was handled and the command is finished, if you return 0 or nothing, you will get Unknown command althought you will still be healed.
}

Quote:

CMD: skin(playerid, params[]) //Putted space after CMD: because it become an emoticon, don't put space after CMDkin!
{
new pickedskin; //Storing the skin he pick.
if(!sscanf(params, "i", pickedskin)) //Checking if he entered anything after /skin, returns 0 if he putted something and 1 if he didn't, the ! in front of sscanf means that if(sscanf(params, "i", pickedskin) == 0)
{
if(pickedskin < 0 || pickedskin > 311) return SendClientMessage(playerid, -1, "Skins are from 0 to 311."); // As he picked it, we are going to check if the value is actualy a skin, skins are from 0 to 311, if it's lower than 0 or bigger than 311 we are telling him that the skin is invalid.
SetPlayerSkin(playerid, pickedskin); //Setting the skin.
SendClientMessage(playerid, -1, "You skin has been changed."); //Telling him that we did it.
}
else return SendClientMessage(playerid, -1, "USAGE: /skin [SKINID]"); //This will trigger if the sscanf params thingy returned anything but 0, in that case this means that he did not put anything after /skin so weare telling him to do so.
return 1; //Just like before, returning 1 to tell that everything has been done so far and executed successfully, if you do not return 1 you will get unkown CMD message, same if you do not put return at all.
}

****** IZCMD and SSCANF in ******, you should find them.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)