Problem with spec
#1

Hello i've two problems with my /spec command:

1) It doesn't save and load the position where you started spectating.
2) If a player enter in a vehicle, the camera view is bugged, it dont follows the player.

Here is:

pawn Код:
CMD:spec(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1) return 0;
    new Float:xpoz,Float:ypoz,Float:zpoz;
    GetPlayerPos(playerid,xpoz,ypoz,zpoz);
    SetPVarFloat(playerid,"XPos",xpoz); SetPVarFloat(playerid,"YPos",ypoz); SetPVarFloat(playerid,"ZPos",zpoz);
    new target;
    if(sscanf(params, "u", target)) return SendClientMessage(playerid, -1, "{F70505}Usage: {FFFFFF}/spec [playerid/name]");
    else if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ORANGE, "Enter a valid player ID/name!");
    TogglePlayerSpectating(playerid, true);
    if(IsPlayerInAnyVehicle(target)) PlayerSpectateVehicle(playerid, GetPlayerVehicleID(target));
    else PlayerSpectatePlayer(playerid, target);
    SendClientMessage(playerid, COLOR_ORANGE, "Type /specoff to stop spectating.");
    GameTextForPlayer(playerid,"~w~Type /specoff to stop spectating.",5000,5);
    return 1;
}

CMD:specoff(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1) return 0;
    SetPlayerPos(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos"));
    SetVehiclePos(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos"));
    TogglePlayerSpectating(playerid, false);
    return 1;
}
Thank you very much
Reply
#2

Maybe this will help you.
https://sampforum.blast.hk/showthread.php?tid=298656
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)