30.04.2014, 07:03
(
Last edited by Eth; 01/06/2014 at 03:19 PM.
)
What do you need?
sscanf2 by y_less:https://sampforum.blast.hk/showthread.php?tid=120356
zcmd by zeex :https://sampforum.blast.hk/showthread.php?tid=91354
Ok Let's start by opening the pawno:
first of all we need to add the float x,y,z,the name of the command and the interior,let's name it teleport:
now we want to make an error , or a message to the player if he didn't type the command correctly! so let's add:
Now we gonna make a message to that player to tell him that he got teleported to a coordinates x,y,z
now we want to finish this command so we are going to type return 1; (so we will not get unkown command)
and close our command bracket
So let me test it in game
let's say that i want to go to :
1681.9612,-2281.1660,13.5126
but i didn't type the coordinates very well:
like i typed 1681.9612 -2281.1660 but didn't write the z:13.5126 or I did type the cordinates but didnt type the interior:
this error will be shown:
sscanf2 by y_less:https://sampforum.blast.hk/showthread.php?tid=120356
zcmd by zeex :https://sampforum.blast.hk/showthread.php?tid=91354
Ok Let's start by opening the pawno:
first of all we need to add the float x,y,z,the name of the command and the interior,let's name it teleport:
pawn Code:
CMD:teleport(playerid,params[])//the command
{//first bracket
new Float:x;//pos x
new Float:y;//pos y
new Float:z;//pos z
new interior;//the interior
pawn Code:
CMD:teleport(playerid,params[])//the command
{//first bracket
new Float:x;//pos x
new Float:y;//pos y
new Float:z;//pos z
new interior;//the interior
if(sscanf(params,"fffi", Float:x, Float:y, Float:z,interior)) return SendClientMessage(playerid, -1,"{FF0000}Error:{FFFFFF}/teleport [x] [y] [z] [interior]");//the message
pawn Code:
CMD:teleport(playerid,params[])//the command
{//first bracket
new Float:x;//pos x
new Float:y;//oos y
new Float:z;//pos z
new interior;
new string[128];//the message string
if(sscanf(params,"fffi", Float:x, Float:y, Float:z,interior)) return SendClientMessage(playerid, -1,"{FF0000}Error:{FFFFFF}/teleport [x] [y] [z] [interior]");//the message
format(string,sizeof(string),"You have been teleported to coordinates: %.0f.%.0f.%.0f",x,y,z);//this is the format for our message
SendClientMessage(playerid,-1,string);//now let's send him this message with the coordinates!
and close our command bracket
pawn Code:
CMD:teleport(playerid,params[])//the command
{//first bracket
new Float:x;//pos x
new Float:y;//oos y
new Float:z;//pos z
new interior;
new string[128];//the message string
if(sscanf(params,"fffi", Float:x, Float:y, Float:z,interior)) return SendClientMessage(playerid, -1,"{FF0000}Error:{FFFFFF}/teleport [x] [y] [z] [interior]");//the message
format(string,sizeof(string),"You have been teleported to coordinates: %.0f.%.0f.%.0f interior: %d",x,y,z,interior);//this is the format for our message
SendClientMessage(playerid,-1,string);//now let's send him this message with the coordinates!
SetPlayerInterior(playerid,interior);//now we will set the player interior
SetPlayerPos(playerid,Float:x,Float:y,Float:z);//now let's teleport him to this pos!
return 1;
}
let's say that i want to go to :
1681.9612,-2281.1660,13.5126
but i didn't type the coordinates very well:
like i typed 1681.9612 -2281.1660 but didn't write the z:13.5126 or I did type the cordinates but didnt type the interior:
this error will be shown: