How would I make a command to teleport them forward, left, right, or back?
#7

So?
pawn Код:
stock Float:GetPosInFrontOfPlayer(playerid, Float:distance, &Float:x, &Float:y, Float:aoffset = 0.00)
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    switch(IsPlayerInAnyVehicle(playerid)) {
        case 0: GetPlayerFacingAngle(playerid, a);
        case 1: GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    a += aoffset;
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}

YCMD:fr(playerid, params[], help) {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerPosInFrontOfPlayer(playerid, 3.0, x, y);
    switch(IsPlayerInAnyVehicle(playerid)) {
        case 0: SetPlayerPos(playerid, x, y, z);
        case 1: SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
    }
    return 1;
}

YCMD:ba(playerid, params[], help) {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerPosInFrontOfPlayer(playerid, -3.0, x, y);
    switch(IsPlayerInAnyVehicle(playerid)) {
        case 0: SetPlayerPos(playerid, x, y, z);
        case 1: SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
    }
    return 1;
}
YCMD:lt(playerid, params[], help) {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerPosInFrontOfPlayer(playerid, -3.0, x, y, -90);
    switch(IsPlayerInAnyVehicle(playerid)) {
        case 0: SetPlayerPos(playerid, x, y, z);
        case 1: SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
    }
    return 1;
}
YCMD:rt(playerid, params[], help) {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerPosInFrontOfPlayer(playerid, -3.0, x, y, 90);
    switch(IsPlayerInAnyVehicle(playerid)) {
        case 0: SetPlayerPos(playerid, x, y, z);
        case 1: SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)