/gotopos | /gotocoords
#1

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
Reply
#2

Код:
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.
Reply
#3

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;

Reply
#4

How do i put this to script then
Reply
#5

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

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

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?
Reply
#8

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.
Reply
#9

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;
}
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)