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(playerid, specplayerid)
{
//Save the players location so we can spawn him there again on stopspec
new LastPos
new Float:x, Float:y, Float:z;
LastPos = GetPlayerPos(playerid, x, y, z);
for(new x=0; x<MAX_PLAYERS; x++)
{
if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && Spec[x][SpectateID] == playerid)
{
AdvanceSpectate(x);
}
}
TogglePlayerSpectating(playerid, 1);
Spec[playerid][SpectateUpdate] = specplayerid;
SetPlayerInterior(playerid,GetPlayerInterior(specplayerid));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(specplayerid));
if(IsPlayerInAnyVehicle(specplayerid))
{
PlayerSpectateVehicle(playerid, GetPlayerVehicleID(specplayerid));
Spec[playerid][SpectateID] = specplayerid;
Spec[playerid][SpectateType] = ADMIN_SPEC_TYPE_VEHICLE;
}
else
{
PlayerSpectatePlayer(playerid, specplayerid);
Spec[playerid][SpectateID] = specplayerid;
Spec[playerid][SpectateType] = ADMIN_SPEC_TYPE_PLAYER;
}
return 1;
}
stock StopSpectate(playerid)
{
SetPlayerPos(playerid, LastPos);
TogglePlayerSpectating(playerid, 0);
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;
}