06.11.2013, 19:23
Since most commands are pretty much the same, you could just do this (function created by me, although there's a similar one on SA-MP forums somewhere):
It will make the script a lot shorter, instead of doing the same thing over and over again:
Example of usage:
SetPlayerPosEx(playerid,"/blueberryfarm","Blueberry Farm",0,0,25,0,0,0x00FF00FF);
Will send the player to a farm in blueberry, and will send a green coloured message
PS Nice work for a new scripter. Good luck with future releases (if you plan any).
pawn Код:
stock SetPlayerPosEx(playerid,cmdname[],locname[],Float:X,Float:Y,Float:Z,int,vw,color) // cmdname = commandname, e.g. /aa, locname = place, e.g. abandoned airport, color is the color of the message that you want to be sent, rest are pretty much straightforward
{
new string[128];
format(string,sizeof(string),"%s has teleported to %s (%s)",PlayerName(playerid),locname,cmdname);
SendClientMessageToAll(color,string);
SetPlayerPos(playerid,X,Y,Z);
SetPlayerInterior(playerid,int);
SetPlayerVirtualWorld(playerid,vw);
return 1;
}
pawn Код:
CMD:teleport1(playerid,params[])
{
new string[128];
SetPlayerPos(playerid,X,Y,Z);
format(string,sizeof(string),"%s has teleported to TP1",PlayerName(playerid));
SendClientMessageToAll(COLOR_GREEN,string);
return 1;
}
...
SetPlayerPosEx(playerid,"/blueberryfarm","Blueberry Farm",0,0,25,0,0,0x00FF00FF);
Will send the player to a farm in blueberry, and will send a green coloured message
PS Nice work for a new scripter. Good luck with future releases (if you plan any).