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



Need Help to Modify Spec System - HydraHumza - 01.11.2014

Hello Friends!

I want to create new spec system. When we do /spec and then when we off /specoff i want to back that place where we start using /spec without spawning at base.

Sorry my speaking English language skills is not so good..

Regards Humza,


Re: Spec - DanishHaq - 01.11.2014

1: Make the command /spec normally, and test to see if it works.
2: Before you using PlayerSpectatingPlayer and TogglePlayerSpectating, save the previous position to a global variable allocated to the player.
3: Make the command /specoff, it would disable TogglePlayerSpectating and it would use SetPlayerPos to the old player's position using the global variables allocated to the player in step 2.


Re: Spec - HydraHumza - 01.11.2014

Quote:
Originally Posted by DanishHaq
Посмотреть сообщение
1: Make the command /spec normally, and test to see if it works.
2: Before you using PlayerSpectatingPlayer and TogglePlayerSpectating, save the previous position to a global variable allocated to the player.
3: Make the command /specoff, it would disable TogglePlayerSpectating and it would use SetPlayerPos to the old player's position using the global variables allocated to the player in step 2.
Can u send me code please because i am new in pawno


Re: Spec - gurmani11 - 01.11.2014

pawn Код:
new Float:SpecX,Float:SpecY,Float:SpecZ;
CMD:spec(playerid, params[])
{
    new id;
    new str[128];
    if(sscanf(params, "u", id))return SendClientMessage(playerid, COLOR_RED, "Error: USAGE: /Spec [ID]");
    if(!IsPlayerConnected(id))return SendClientMessage(playerid, COLOR_RED, "Error: Player is not connected!");
    GetPlayerPos(playerid,SpecX,SpecY,SpecZ);
    TogglePlayerSpectating(playerid, 1);
    PlayerSpectatePlayer(playerid, id);
    SetPlayerInterior(playerid, GetPlayerInterior(id));
    return 1;
}
CMD:specoff(playerid, params[])
{
    TogglePlayerSpectating(playerid, 0);
    SetPlayerPos(playerid,SpecX,SpecY,SpecZ);
    return 1;
}



Re: Spec - HydraHumza - 01.11.2014

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
pawn Код:
new Float:SpecX,Float:SpecY,Float:SpecZ;
CMD:spec(playerid, params[])
{
    new id;
    new str[128];
    if(sscanf(params, "u", id))return SendClientMessage(playerid, COLOR_RED, "Error: USAGE: /Spec [ID]");
    if(!IsPlayerConnected(id))return SendClientMessage(playerid, COLOR_RED, "Error: Player is not connected!");
    GetPlayerPos(playerid,SpecX,SpecY,SpecZ);
    TogglePlayerSpectating(playerid, 1);
    PlayerSpectatePlayer(playerid, id);
    SetPlayerInterior(playerid, GetPlayerInterior(id));
    return 1;
}
CMD:specoff(playerid, params[])
{
    TogglePlayerSpectating(playerid, 0);
    SetPlayerPos(playerid,SpecX,SpecY,SpecZ);
    return 1;
}
it showing 7 errors


Re: Spec - gurmani11 - 01.11.2014

show them dont say...


Re: Spec - Crayder - 01.11.2014

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
pawn Код:
new Float:SpecX,Float:SpecY,Float:SpecZ;
CMD:spec(playerid, params[])
{
    new id;
    new str[128];
    if(sscanf(params, "u", id))return SendClientMessage(playerid, COLOR_RED, "Error: USAGE: /Spec [ID]");
    if(!IsPlayerConnected(id))return SendClientMessage(playerid, COLOR_RED, "Error: Player is not connected!");
    GetPlayerPos(playerid,SpecX,SpecY,SpecZ);
    TogglePlayerSpectating(playerid, 1);
    PlayerSpectatePlayer(playerid, id);
    SetPlayerInterior(playerid, GetPlayerInterior(id));
    return 1;
}
CMD:specoff(playerid, params[])
{
    TogglePlayerSpectating(playerid, 0);
    SetPlayerPos(playerid,SpecX,SpecY,SpecZ);
    return 1;
}
You need to use per player variables, those are server wide, so if two people were spectating the first guy would be set to the second guys position


Re: Spec - HydraHumza - 01.11.2014

Friends Thanks for ur support i make it
Thanks for all <3