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



Spec help! - The$amurai[AUS] - 20.10.2011

Okay guys, I need a filterscript for a spec command.
Basicly I want:
1. /spec [id/part of name] ( will detect weather it's a walking spec or vehicle )
2. /endspec ( will obviously end the spec and return player to the position that they typed '/spec ***'.

I have found and tried shit loads of filterscripts that will spec fine, But on /endspec it respawns randomly. I would like it to respawn to the position where they started the spec...

Please help.

Anything helpful would be amazing.


Re: Spec help! - Issam - 20.10.2011

Use " GetPlayerPos(playerid, x, y, z); "
Post your codes,and il fix it for you.


Re: Spec help! - The$amurai[AUS] - 20.10.2011

http://pastebin.com/dWhVrSMF

Would you be able to port it back as a .pwn or something?

Thanks alot man!

I'll put you in credits. :3


Re: Spec help! - Issam - 20.10.2011

PHP код:
//------------------------------------------------------------------------------
 
stock StartSpectate(playeridspecplayerid)
{      
         
        
//Save the players location so we can spawn him there again on stopspec
        
new LastPos
        
new Float:xFloat:yFloat:z;
        
LastPos GetPlayerPos(playeridxyz);
        
        for(new 
x=0x<MAX_PLAYERSx++)
        {
            if(
GetPlayerState(x) == PLAYER_STATE_SPECTATING && Spec[x][SpectateID] == playerid)
                {
               
AdvanceSpectate(x);
                }
        }
        
TogglePlayerSpectating(playerid1);
        
Spec[playerid][SpectateUpdate] = specplayerid;
        
SetPlayerInterior(playerid,GetPlayerInterior(specplayerid));
        
SetPlayerVirtualWorld(playeridGetPlayerVirtualWorld(specplayerid));
        if(
IsPlayerInAnyVehicle(specplayerid))
        {
                
PlayerSpectateVehicle(playeridGetPlayerVehicleID(specplayerid));
                
Spec[playerid][SpectateID] = specplayerid;
                
Spec[playerid][SpectateType] = ADMIN_SPEC_TYPE_VEHICLE;
        }
        else
        {
                
PlayerSpectatePlayer(playeridspecplayerid);
                
Spec[playerid][SpectateID] = specplayerid;
                
Spec[playerid][SpectateType] = ADMIN_SPEC_TYPE_PLAYER;
        }
        return 
1;
}
 
stock StopSpectate(playerid)
{
        
SetPlayerPos(playeridLastPos);
       
TogglePlayerSpectating(playerid0);
        
Spec[playerid][SpectateID] = INVALID_PLAYER_ID;
        
Spec[playerid][SpectateType] = ADMIN_SPEC_TYPE_NONE;
        
Spec[playerid][SpectateUpdate] = 255;
        
GameTextForPlayer(playerid,"~n~~n~~n~~w~Spectate mode ended",1000,3);
        return 
1;