Help with spectation
#1

Hi all. Need help with spectation. Command works ok, but when I wana stop spectation, system returns me to bad position ( system have to return me to my last positon, but returns to my login positon, where I loged last time ). Why?

Код:
CMD:spec(playerid,params[])
{
	if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) return StopSpec(playerid);
	new id;
        if(sscanf(params, "u", id)) return SendError(playerid,"Use: /spec [ID]");
	new mess[80 + MAX_PLAYER_NAME];
 	SpectatingIS(playerid);
	SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
	SetPlayerInterior(playerid, GetPlayerInterior(id));
	TogglePlayerSpectating(playerid, true);
	if(IsPlayerInAnyVehicle(id)) PlayerSpectateVehicle(playerid, GetPlayerVehicleID(id));
	else PlayerSpectatePlayer(playerid, id);
	return 1;
}
Код:
stock SpectatingIS(playerid)
{
        statec[playerid] = true;
	GetPlayerPos(playerid, krd[playerid][0], krd[playerid][1], krd[playerid][2]);
	pInfo[playerid][world] = GetPlayerVirtualWorld(playerid);
	for(new slot = 0; slot < 13; slot ++) GetPlayerWeaponData(playerid,slot,weaps[playerid]
        [slot],amunition[playerid][slot]);
	pInfo[playerid][interior] = GetPlayerInterior(playerid);
	return 1;
}
Код:
stock StopSpec(playerid)
{
        statec[playerid] = true;
        SetPlayerPos(playerid, krd[playerid][0], krd[playerid][1], krd[playerid][2]);
        SetPlayerVirtualWorld(playerid, pInfo[playerid][world]);
	SetPlayerInterior(playerid,pInfo[playerid][interior]);
	TogglePlayerSpectating(playerid,false);
	if(pInfo[playerid][ant] == false) TogglePlayerControllable(playerid,true);
	for(new slot=0; slot < 13; slot++) GivePlayerWeaponEx(playerid,weaps[playerid][slot], amunition[playerid]
        [slot]);
	return 1;
}
Reply


Messages In This Thread
Help with spectation - by ,TomY' - 26.07.2017, 13:35
Re: Help with spectation - by aoky - 26.07.2017, 13:44
Re: Help with spectation - by ,TomY' - 26.07.2017, 13:54
Re: Help with spectation - by zsoolt997 - 26.07.2017, 14:19
Re: Help with spectation - by IceBilizard - 26.07.2017, 14:46

Forum Jump:


Users browsing this thread: 1 Guest(s)