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



Teleport - kalanerik99 - 02.02.2015

Hello
I wanna now why if I am in dm or I am not driver it teleports me
How to make that it won't?


Код:
public CheckTeleporting(playerid)
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return GameTextForPlayer(playerid,"~w~You ~r~aren't ~w~driver!",3000,5);
if(InDM[playerid] == 1) return GameTextForPlayer(playerid, "~g~Type /kill first",2000,5);
return 1;
}
CMD:ap(playerid)
{
CheckTeleporting(playerid);
SetPlayerVirtualWorld(playerid,0);
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,-2097.3215,-2518.6458,30.1997);
new string[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
new vehicleid = GetPlayerVehicleID(playerid);
SetVehiclePos(vehicleid,-2097.3215,-2518.6458,30.1997);
SetPlayerFacingAngle(playerid, 46.9913);
SetVehicleZAngle(vehicleid, 46.9913);
PutPlayerInVehicle(playerid, vehicleid, 0);
return 1;
}



Re: Teleport - kalanerik99 - 02.02.2015

bump


Re: Teleport - Jefff - 02.02.2015

pawn Код:
public CheckTeleporting(playerid)
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return !GameTextForPlayer(playerid,"~w~You ~r~aren't ~w~driver!",3000,5);
    if(InDM[playerid] == 1) return !GameTextForPlayer(playerid, "~g~Type /kill first",2000,5);
    return 1;
}
CMD:ap(playerid)
{
    if(!CheckTeleporting(playerid)) return 1;
    SetPlayerVirtualWorld(playerid,0);
    SetPlayerInterior(playerid,0);
    SetPlayerPos(playerid,-2097.3215,-2518.6458,30.1997);
    new string[256], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    new vehicleid = GetPlayerVehicleID(playerid); // will be always 0 (not in vehicle) because you sets player position before
    SetVehiclePos(vehicleid,-2097.3215,-2518.6458,30.1997);
    SetPlayerFacingAngle(playerid, 46.9913);
    SetVehicleZAngle(vehicleid, 46.9913);
    PutPlayerInVehicle(playerid, vehicleid, 0);
    return 1;
}



Re: Teleport - kalanerik99 - 02.02.2015

It doesn't work it says You aren't driver even if I am outside the car

pawn Код:
public CheckTeleporting(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return !GameTextForPlayer(playerid,"~w~You ~r~aren't ~w~driver!",3000,5);
}
if(InDM[playerid] == 1) return !GameTextForPlayer(playerid, "~g~Type /kill first",2000,5);
return 1;
}

CMD:ap(playerid)
{
    if(!CheckTeleporting(playerid)) return 1;
    SetPlayerVirtualWorld(playerid,0);
    SetPlayerInterior(playerid,0);
    SetPlayerPos(playerid,-2097.3215,-2518.6458,30.1997);
    new string[256], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    new vehicleid = GetPlayerVehicleID(playerid);
    SetVehiclePos(vehicleid,-2097.3215,-2518.6458,30.1997);
    SetPlayerFacingAngle(playerid, 46.9913);
    SetVehicleZAngle(vehicleid, 46.9913);
    PutPlayerInVehicle(playerid, vehicleid, 0);
    return 1;
}



Re: Teleport - Jefff - 02.02.2015

If you are outside you are not driver? so whats the problem xd


Re: Teleport - kalanerik99 - 02.02.2015

but even if I am driving or in dm