SA-MP Forums Archive
help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: help (/showthread.php?tid=290207)



help - noder51 - 14.10.2011

can you help me how to make teleports?
like /race
thank you very much if u help!


Re: help - Tom1412 - 14.10.2011

a teleport is easy
all it is is command basic and setplayerpos

but thats a basic one like gotols

For others you will need to get the x,y,z and bit then tell it togoto the x,y,z you just got


Re: help - noder51 - 14.10.2011

but i want to do when i do /race
i will teleport the x y z that i enterd can u give me a tut?


Re: help - Kostas' - 14.10.2011

If you want only On Foot:
pawn Code:
if (strcmp(cmdtext, "/race", true) == 0) {
        RemovePlayerFromVehicle(playerid);
        SetPlayerPos(playerid,x,y,z);
        GameTextForPlayer(playerid,"Welcome to race!",4000,6);
        return 1;
    }
If else On Vehicle:
pawn Code:
if (!strcmp(cmdtext, "/race", true)) {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(GOTOPLAYER,x,y,z);
        if (GetPlayerState(playerid)==PLAYER_STATE_DRIVER)SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
        else SetPlayerPos(playerid,x,y,z);
        return 1;
    }



Re: help - noder51 - 14.10.2011

thanks!


Re: help - noder51 - 14.10.2011

rep+


Re: help - Kostas' - 14.10.2011

Thanks and Your Welcome!


Re: help - noder51 - 15.10.2011

where do i put that? in onplayertextcommand?
im building a new mod from 0


Re: help - GrimR - 15.10.2011

If you are not using ZCMD/DCMD then yes OnPlayerCommandText.

pawn Code:
if (!strcmp(cmdtext, "/race", true))
  {
    new Float: x, Float: y, Float: z;
       
    GetPlayerPos(GOTOPLAYER, x, y, z);
       
    if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z); }
    else { SetPlayerPos(playerid, x, y, z); }
    return 1;
    }
GETPLAYERPOS would be the ID of the player you want to warp them to. If this is not the case, set the x, y and z values to where you want them to warp in place of GetPlayerPos.


Re: help - $India$ - 15.10.2011

If you want it with ZCMD this is the Code.
pawn Code:
CMD:race(playerid, params[])
{
     new Float: x, Float: y, Float: z;
     GetPlayerPos(GOTOPLAYER, x, y, z);

     if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER_
     {
          SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);    
     }
     else
     {
          SetPlayerPos(playerid, x, y, z);
     }
           
     return 1;
}



Re: help - noder51 - 15.10.2011

C:\Documents and Settings\\Desktop\hot frap backup\HotFrapNewServerScriptByNinjaa.pwn(235) : error 001: expected token: "-identifier-", but found "-rational value-"
C:\Documents and Settings\\Desktop\hot frap backup\HotFrapNewServerScriptByNinjaa.pwn(237) : error 017: undefined symbol "GOTOPLAYER"
C:\Documents and Settings\\Desktop\hot frap backup\HotFrapNewServerScriptByNinjaa.pwn(239) : warning 202: number of arguments does not match definition
C:\Documents and Settings\\Desktop\hot frap backup\HotFrapNewServerScriptByNinjaa.pwn(240) : error 017: undefined symbol "x"
C:\Documents and Settings\\Desktop\hot frap backup\HotFrapNewServerScriptByNinjaa.pwn(243) : warning 209: function "OnPlayerCommandText" should return a value
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
what is it mean?
thats what i did
if (!strcmp(cmdtext, "/race", true))
{
new Float:2057.3955, Float:861.6058, Float:6.7143,181;

GetPlayerPos(GOTOPLAYER, x, y, z);

if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { SetVehiclePos(GetPlayerVehicleID(playerid), 2057.3955, 861.6058, 6.7143,181); }
else { SetPlayerPos(playerid, x, y, z); }
return 1;
}
i rily need help!


Re: help - Kostas' - 15.10.2011

First, use [pawn] for the script.
At the top
pawn Code:
new GOTOPLAYER;
And at the
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/race", true)) {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(GOTOPLAYER,x,y,z);
        if (GetPlayerState(playerid)==PLAYER_STATE_DRIVER)SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
        else SetPlayerPos(playerid,x,y,z);
        ResetPlayerWeapons(playerid);
        return 1;
    }
//More
==============================================
EDIT:
Here is your mistake


Quote:
Originally Posted by noder51
View Post
pawn Code:
new Float:2057.3955, Float:861.6058, Float:6.7143,181;

GetPlayerPos(GOTOPLAYER, x, y, z);
You need to have them
pawn Code:
new Float:x, Float:y, Float:z;
And here your coordinates
pawn Code:
GetPlayerPos(GOTOPLAYER, 2057.3955, 861.6058, 6.7143,181);



Re: help - Mr_Scripter - 15.10.2011

pawn Code:
if(!strcmp(cmdtext, "//race", true)){
   if(!IsPlayerInAnyVehicle(playerid)){
       SetPlayerPos(playerid, 0.0, 0.0, 0.0);
       SetPlayerFacingAngle(playerid, 0.0);
       SetPlayerInterior(playerid, 0);
       SetPlayerVirtualWorld(playerid, 0);
   }
   else{
       new veh = GetPlayerVehicleID(playerid);
       SetVehiclePos(veh, 0.0, 0.0, 0.0);
       SetVehicleZAngle(veh, 0.0);
       LinkVehicleToInterior(veh, 0);
       SetVehicleVirtualWorld(veh, 0);
       PutPlayerInVehicle(playerid, veh, 0);
   }
   return 1;
}
without car
pawn Code:
if(!strcmp(cmdtext, "//tp", true)){
   SetPlayerPos(playerid, 0.0, 0.0, 0.0);//Change the Cords
   SetPlayerFacingAngle(playerid, 0.0);
   SetPlayerInterior(playerid, 0);
   SetPlayerVirtualWorld(playerid, 0);
   return 1;
}
Rep me if it helped

Edit the X,Y,Z cords
Not Tested