SA-MP Forums Archive
/gotopos | /gotocoords - 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: /gotopos | /gotocoords (/showthread.php?tid=597536)



/gotopos | /gotocoords - iKevin - 01.01.2016

Hello people. I'd like to ask if anybody of you can script a command /gotopos or /gotocoords [x] [y] [z] [int] so i can place interiors on my server. And please tell me how do I put it in.. I just paste it into the GM.pwn and atart it?

Kind regards;
Kevin



Re: /gotopos | /gotocoords - Crystallize - 01.01.2016

Код:
CMD:gotopos(playerid,params[]) 
{
	new
	  Float:pos1,
	  Float:pos2,
	  int;
	if(sscanf(params,"fffd",floatstr(params),pos1,pos2,int)) return SendClientMessage(playerid,color,"USAGE: /gotopos [x] [y] [z] [interiorid]");
	if(IsPlayerInAnyVehicle(playerid))
	{
		SetVehiclePos(GetPlayerVehicleID(playerid),floatstr(params),pos1,pos2);
		LinkVehicleToInterior(GetPlayerVehicleID(playerid),int);
	}
  else
  {
		SetPlayerPos(playerid,floatstr(params),pos1,pos2);
		SetPlayerInterior(playerid,int);
	}
  return 1;
}
Next time SEARCH.


Re: /gotopos | /gotocoords - saffierr - 01.01.2016

Here you go
PHP код:
CMD:gotopos(playeridparams[])
{
    new 
string[75],  Float:XFloat:YFloat:Z;
    if(
sscanf(params"fff"Float:XFloat:YFloat:Z)) return SendClientMessage(playerid, -1"Usage: /gotopos [X-Y-Z]");
    
SetPlayerPos(playeridFloat:XFloat:YFloat:Z);
    
format(stringsizeof string"You are teleported to position 'X'%f 'Y'%f 'Z'%f"Float:XFloat:YFloat:Z);
    
SendClientMessage(playeridCOLOR_LIGHTGREENstring);
    return 
1;




Re: /gotopos | /gotocoords - iKevin - 01.01.2016

How do i put this to script then


Re: /gotopos | /gotocoords - Crystallize - 01.01.2016

Quote:
Originally Posted by KevinExec
Посмотреть сообщение
How do i put this to script then
paste it on ur .pwn


Re: /gotopos | /gotocoords - iKevin - 01.01.2016

I did and i reuploaded it on the hostsite..gmxed.. not working


Re: /gotopos | /gotocoords - ThomasEvil - 27.03.2017

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Here you go
PHP код:
CMD:gotopos(playeridparams[])
{
    new 
string[75],  Float:XFloat:YFloat:Z;
    if(
sscanf(params"fff"Float:XFloat:YFloat:Z)) return SendClientMessage(playerid, -1"Usage: /gotopos [X-Y-Z]");
    
SetPlayerPos(playeridFloat:XFloat:YFloat:Z);
    
format(stringsizeof string"You are teleported to position 'X'%f 'Y'%f 'Z'%f"Float:XFloat:YFloat:Z);
    
SendClientMessage(playeridCOLOR_LIGHTGREENstring);
    return 
1;

What if i want to use /gotopos 0,0,0
instead of /gotopos 0 0 0
Please?


Re: /gotopos | /gotocoords - Dayrion - 27.03.2017

Quote:
Originally Posted by ThomasEvil
Посмотреть сообщение
What if i want to use /gotopos 0,0,0
instead of /gotopos 0 0 0
Please?
It will not work. sscanf is looking in your string 3 float values. 0,0,0 isn't a value. That's why.


Re: /gotopos | /gotocoords - Unte99 - 27.03.2017

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
It will not work. sscanf is looking in your string 3 float values. 0,0,0 isn't a value. That's why.
Put this in your gamemode and see if using the command as /coordinates 0 0 0 works:

pawn Код:
CMD:coordinates(playerid, params[])
{
    new Float:x,Float:y,Float:z;
    if(!sscanf(params, "fff",x,y,z))
    SetPlayerPos(playerid, x,y,z);
    return 1;
}



Re: /gotopos | /gotocoords - Dayrion - 27.03.2017

Quote:
Originally Posted by Unte99
Посмотреть сообщение
Put this in your gamemode and see if using the command as /coordinates 0 0 0 works:

pawn Код:
CMD:coordinates(playerid, params[])
{
    new Float:x,Float:y,Float:z;
    if(!sscanf(params, "fff",x,y,z))
    SetPlayerPos(playerid, x,y,z);
    return 1;
}
Yes... Try with 0,0,0