spectate server crash [+Rep]
#1

hello guys i have a problem when a player dies he will spectate a random alive player works but when the other map loads and function spectateoff called the server crash plz help

pawn Код:
forward SpectateOn(playerid);
public SpectateOn(playerid)
{
    print("SpectateOn");
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(Player[i][IsPlaying] &&  playerid != i)
        {
        TogglePlayerSpectating(playerid, 1);
        PlayerSpectatePlayer(playerid, i);
        SetPlayerInterior(playerid, GetPlayerInterior(i));
        PlayerSpectateVehicle(playerid, Player[i][VehicleID]);
        SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(i));
        Player[playerid][SpectateID] = i;
        }
    }
    new str[128];
    if(Player[playerid][SpectateID] != -1)
    {
    format(str, 128, "You are now spectating %s (ID:%d).", PlayerName(Player[playerid][SpectateID]), Player[playerid][SpectateID]);
    SendClientMessage(playerid, COLOR_WHITE, str);
    }
    return 1;
}

forward SpectateOff(playerid);
public SpectateOff(playerid)
{
    print("SpectateOff");
    TogglePlayerSpectating(playerid, 0);
    Player[playerid][SpectateID] = -1;
    SendClientMessage(playerid, COLOR_WHITE, "You stopped spectating.");
    return 1;
}
thnx and sorry for my bad english
Reply
#2

upp!
Reply
#3

bump!
Reply
#4

Upp! help
Reply
#5

try to call the speacte off fuction after map complete loading
Reply
#6

Quote:
Originally Posted by jlalt
Посмотреть сообщение
try to call the speacte off fuction after map complete loading
already same server crashed
Reply
#7

Quote:
Originally Posted by simo0000
Посмотреть сообщение
already same server crashed
are you sure the problem here?
PHP код:
forward SpectateOff(playerid);
public 
SpectateOff(playerid)
{
    print(
"SpectateOff");
    
TogglePlayerSpectating(playerid0);
    
Player[playerid][SpectateID] = -1;
    
SendClientMessage(playeridCOLOR_WHITE"You stopped spectating.");
    return 
1;

when you remove it server not crasheing?
Reply
#8

when i remove it the other map won't load
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)