[Help] SetPlayerPos is not working
#1

Ok so here it is, I am making it where if u enter a cop car and your not a police, you will teleport z+2.0, anyone?
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate == 2)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(GetVehicleModel(vehicleid) == 405)
        {
            GameTextForPlayer(playerid, "Civilian Vehicle", 3000, 3);
            TogglePlayerControllable(playerid, 0);
            SendClientMessage(playerid, COLOR_WHITE, "You can start your engine by typing: /start");
            return 1;
        }
        else if(GetVehicleModel(vehicleid) == 596)
        {
            new Float:x, Float:y, Float:z = SetPlayerPos(playerid,x,y,z);
            if(gTeam[playerid] != POLICE) return SendClientMessage(playerid, COLOR_RED, "You are not a cop!") || SetPlayerPos(playerid,x,y,z+2.0);
            TogglePlayerControllable(playerid, 0);
            SendClientMessage(playerid, COLOR_WHITE, "You can start your engine by typing: /start");
            return 1;
        }
        return 1;
    }
    return 1;
}
Reply
#2

Код:
new Float:x, Float:y, Float:z;
SetPlayerPos(playerid,x,y,z);
Reply
#3

Quote:
Originally Posted by LeNy
Посмотреть сообщение
Код:
new Float:x, Float:y, Float:z;
SetPlayerPos(playerid,x,y,z);
I already have that, its in the script...
Reply
#4

You don't have the coordinate where they will be positioned. Do you mean next or top of the car ?
Reply
#5

Why are you doing this? :S
Use SetVehicleParamsForPlayer instead...
Reply
#6

SetVehicleParamsForPlayer has it's downs, It has to be re-synced every time a vehicle is streamed in (Which would require a loop, checking if it's a cop vehicle or something, every time a vehicle comes into sight)

And you can't get in it as a passenger, it's best to keep it at OnPlayerStateChange.

pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new vehicleid = GetPlayerVehicleID(playerid), m = GetVehicleModel(vehicleid);
        if(m == 405)
        {
            GameTextForPlayer(playerid, "Civilian Vehicle", 3000, 3);
            TogglePlayerControllable(playerid, 0);
            SendClientMessage(playerid, COLOR_WHITE, "You can start your engine by typing: /start");
        }
        else if(m == 596)
        {
            new Float:x, Float:y, Float:z;
            if(gTeam[playerid] != POLICE)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You are not a cop!");
            }
            TogglePlayerControllable(playerid, 0);
            SendClientMessage(playerid, COLOR_WHITE, "You can start your engine by typing: /start");
        }
        return 1;
    }
    return 1;
}
Reply
#7

Just do this when they enter the car, "RemovePlayerFromVehicle" so much eaiser on you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)