SA-MP Forums Archive
Problem with spec - 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: Problem with spec (/showthread.php?tid=385906)



Problem with spec - Face9000 - 18.10.2012

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


Re: Problem with spec - newbienoob - 18.10.2012

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