SA-MP Forums Archive
Bugy Teleport please help! - 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: Bugy Teleport please help! (/showthread.php?tid=512800)



Bugy Teleport please help! - KillerStrike23 - 12.05.2014

hey I have a problem with my tps when someone teleport using a car he go to the teleport place for 2 seconds and then get back to his last point before teleporting but If player wasn't in a vehicle he teleport normly here is my code :
pawn Код:
CMD:sfa(playerid,params[]) {
    if(PlayerInfo[playerid][Jailed] == 1) return SendClientMessage(playerid,COLOR_BRIGHTRED,"You cannot escape your punishment!");
    instunt[playerid] = 1;
    TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    tseconds[playerid] = 6;
    format(tstring,45,"You Must wait %d seconds before teleporting", tseconds[playerid]-1);
    if(PlayerInfo[playerid][Level] == 0) SendClientMessage(playerid,COLOR_LIGHTBLUE, tstring);
    vCount[playerid] = 1;
    Tx[playerid] =-1657.5400;
    Ty[playerid] =-164.9457;
    Tz[playerid] =14.1484;
    Ti[playerid] = 0;
    new string[128];
    new dsname[MAX_PLAYER_NAME];
    format(telestring,43,"~y~[] San Fierro Airport[]");
    GetPlayerName(playerid, dsname, sizeof(dsname));
    format(string, sizeof(string), "[TELE]:%s Has Just Teleported To San Fierro Airport /sfa", dsname);
    SendClientMessageToAll(COLOR_LIGHTBLUE, string);
    ShowPlayerDialog( playerid, DIALOGID3+40, DIALOG_STYLE_LIST, "Vehicle Types", "Bikes\nConvertibles\nIndustrial\nLowriders\nOff Road\nPublic Service Vehicles\nSaloons\nSport Vehicles\nStation Wagons", "Select", "Cancel" );
    return 1;}
timer :

pawn Код:
public ttimer(playerid){
    if(InDM[playerid]==1) tseconds[playerid]=0, SetTimerEx("resetTcount",20000, 0, "i", playerid), KillTimer(TeleTimer), SendClientMessage(playerid, COLOR_RED, "You must leave the DM with /exitdm first!");
    if (tseconds[playerid]){
        format(tstring,6,"~w~%d", tseconds[playerid]-1);
        GameTextForPlayer(playerid,tstring,1100,4);
        tseconds[playerid] --;
        if(PlayerInfo[playerid][Level] >= 1) tseconds[playerid] = 0;
        if (!tseconds[playerid]){
            new vsid = GetPlayerVehicleID(playerid);
            if (Ti[playerid]>=0) SetPlayerInterior(playerid,Ti[playerid]), Ti[playerid]=-1;
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) SetVehiclePos(vsid,Tx[playerid],Ty[playerid],Tz[playerid]), PutPlayerInVehicle(playerid,vsid,0);
            else SetPlayerPos(playerid,Tx[playerid],Ty[playerid],Tz[playerid]);
            GameTextForPlayer(playerid,telestring,2500,3);
            KillTimer(TeleTimer);
            SetTimerEx("resetTcount",20000, 0, "i", playerid);}}}

stock TimedTele(playerid, telename[], Float:Px, Float:Py, Float:Pz, interior, seconds){
    if(PlayerInfo[playerid][Jailed] == 1) return SendClientMessage(playerid,COLOR_BRIGHTRED,"You cannot escape your punishment!");
    TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    tseconds[playerid] = seconds;
    format(tstring,45,"You Must wait %d seconds before teleporting", tseconds[playerid]-1);
    if(PlayerInfo[playerid][Level] == 0) SendClientMessage(playerid,COLOR_LIGHTBLUE, tstring);
    vCount[playerid] = 1;
    Tx[playerid] =Px;
    Ty[playerid] =Py;
    Tz[playerid] =Pz;
    Ti[playerid] = interior;
    format(telestring,43,telename);
    return 1;}
so ?


Re: Bugy Teleport please help! - Konstantinos - 12.05.2014

The player is already in the vehicle so no need to re-put him/her. Just set the vehicle's position:
pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) SetVehiclePos(vsid,Tx[playerid],Ty[playerid],Tz[playerid]);



Re: Bugy Teleport please help! - KillerStrike23 - 03.06.2014

lol I got it now ty very much my server was awful because of the tps and not it works fine thanks very much your da best .