01.08.2012, 18:01
When I stop to spectate I respawn. I want to spawn where I was when I started to spectate. Understand? :P
And if I'm in a vehicle I want back to that vehicle. :P I have no idea how to make it :P Thanks for help!
Spec and Specoff CMDS.
And if I'm in a vehicle I want back to that vehicle. :P I have no idea how to make it :P Thanks for help!

Spec and Specoff CMDS.
Код:
YCMD:spec(playerid, params[], help) { #pragma unused help if(P_Data[playerid][pAdmin] < 2) return SCM(playerid, COLOR_RED, "You need to be admin level 2 to use this!"); new pplayerid,Float:Pos[3],string[128]; if(sscanf(params, "u", pplayerid)) return SCM(playerid, COLOR_RED, "Usage: /spec [Player ID/Player Name]"); if(pplayerid == IPI) return SCM(playerid, COLOR_RED, "Wrong playerid!"); foreach(Player, i) { if(P_Data[i][pAdmin] > 0) { format(string,sizeof(string),"%s is spectating: %s ",GetName(playerid),GetName(pplayerid)); SCM(i,-1,string);}} GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]); SetPVarFloat(playerid,"XPos",Pos[0]); SetPVarFloat(playerid,"YPos",Pos[1]); SetPVarFloat(playerid,"ZPos",Pos[2]); SetPVarInt(playerid,"Interior",GetPlayerInterior(playerid)); SetPVarInt(playerid,"VW",GetPlayerVirtualWorld(playerid)); P_Data[playerid][pSpecating] = 1; format(string,sizeof(string),"~g~Name: ~w~%s ~g~Score: ~w~%d ~g~Money: ~w~%d",GetName(pplayerid),GetPlayerScore(pplayerid),GetPlayerMoney(pplayerid)); TextDrawSetString(Spec1[playerid],string); TextDrawShowForPlayer(playerid,Spec1[playerid]); TextDrawShowForPlayer(playerid,Spec0[playerid]); if ( !IsPlayerInAnyVehicle(pplayerid) ) { TogglePlayerSpectating(playerid, 1); PlayerSpectatePlayer(playerid, pplayerid); SetPlayerInterior(playerid,GetPlayerInterior(pplayerid)); SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(pplayerid)); return 1; } else { TogglePlayerSpectating(playerid, 1); PlayerSpectateVehicle(playerid, GetPlayerVehicleID(pplayerid)); SetPlayerInterior(playerid,GetPlayerInterior(pplayerid)); SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(pplayerid)); } return 1; } YCMD:specoff(playerid, params[], help) { #pragma unused help #pragma unused params if(P_Data[playerid][pAdmin] < 2) return SCM(playerid, COLOR_RED, "You need to be admin level 2 to use this!"); if(P_Data[playerid][pSpecating] == 0)return SCM(playerid, COLOR_RED, "You don't specate nobody!"); TogglePlayerSpectating(playerid, 0); SetPlayerPos(playerid,GetPVarFloat(playerid,"XPos"),GetPVarFloat(playerid,"YPos"),GetPVarFloat(playerid,"ZPos")); SetPlayerInterior(playerid,GetPVarInt(playerid,"Interior")); SetPlayerVirtualWorld(playerid, GetPVarInt(playerid,"VW")); SetPVarFloat(playerid,"XPos",999); SetPVarFloat(playerid,"YPos",999); SetPVarFloat(playerid,"ZPos",999); SetPVarInt(playerid,"Interior",0); SetPVarInt(playerid,"VW",0); P_Data[playerid][pSpecating] = 0; TextDrawHideForPlayer(playerid,Spec1[playerid]); TextDrawHideForPlayer(playerid,Spec0[playerid]); return 1; }