error 010: invalid function or declaration
#1

I tried to use this spectating function but error spikes while compiling
Code:

PHP код:
new Spectating[MAX_PLAYERS],GettingSpectated[MAX_PLAYERS],Spectate[MAX_PLAYERS],SpecTime[MAX_PLAYERS];
SpectatePlayer(playerid, giveplayerid)
{
    if(
IsPlayerConnected(giveplayerid)) {
        if( 
InsideTut{giveplayerid} >= 1 ) {
            
SendClientMessage(playerid, COLOR_WHITE, "NOTE: This person is in the tutorial. Please consider this before assuming that they're air-breaking.");
        }
        if(
PlayerInfo[giveplayerid][pAccountRestricted]) SendClientMessage(playerid, COLOR_WHITE, "NOTE: This person has their account restricted. Please consider this before assuming that they're health hacking.");
        if(
Spectating[playerid] == 0) {
            new 
Float: pPositions[3];
            
GetPlayerPos(playerid, pPositions[0], pPositions[1], pPositions[2]);
            
SetPVarFloat(playerid, "SpecPosX", pPositions[0]);
            
SetPVarFloat(playerid, "SpecPosY", pPositions[1]);
            
SetPVarFloat(playerid, "SpecPosZ", pPositions[2]);
            
SetPVarInt(playerid, "SpecInt", GetPlayerInterior(playerid));
            
SetPVarInt(playerid, "SpecVW", GetPlayerVirtualWorld(playerid));
            if(
IsPlayerInAnyVehicle(giveplayerid)) {
                
TogglePlayerSpectating(playerid, true);
                new 
carid = GetPlayerVehicleID( giveplayerid );
                
PlayerSpectateVehicle( playerid, carid );
                
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
                
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
            }
            else if(
InsidePlane[giveplayerid] != INVALID_VEHICLE_ID) {
                
TogglePlayerSpectating(playerid, true);
                
PlayerSpectateVehicle(playerid, InsidePlane[giveplayerid]);
                
SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
                
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
            }
            else {
                for(new 
i = 0; i < 2; i++) {
                    
TogglePlayerSpectating(playerid, true);
                    
PlayerSpectatePlayer( playerid, giveplayerid );
                    
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
                    
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
                }    
            }
            
GettingSpectated[giveplayerid] = playerid;
            if(
Spectate[playerid] != giveplayerid) SpecTime[playerid] = gettime();
            
Spectate[playerid] = giveplayerid;
            
Spectating[playerid] = 1;
        }
        else {
            if(
IsPlayerInAnyVehicle(giveplayerid)) {
                
TogglePlayerSpectating(playerid, true);
                new 
carid = GetPlayerVehicleID( giveplayerid );
                
PlayerSpectateVehicle( playerid, carid );
                
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
                
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
            }
            else if(
InsidePlane[giveplayerid] != INVALID_VEHICLE_ID) {
                
TogglePlayerSpectating(playerid, true);
                
PlayerSpectateVehicle(playerid, InsidePlane[giveplayerid]);
                
SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
                
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
            }
            else {
                for(new 
i = 0; i < 2; i++) {
                    
TogglePlayerSpectating(playerid, true);
                    
PlayerSpectatePlayer( playerid, giveplayerid );
                    
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
                    
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
                }    
            }
            
GettingSpectated[Spectate[playerid]] = INVALID_PLAYER_ID;
            
GettingSpectated[giveplayerid] = playerid;
            if(
Spectate[playerid] != giveplayerid) {
                
SpecTime[playerid] = gettime();
                
Spectate[playerid] = giveplayerid;
                
Spectating[playerid] = 1;
            }
        }
        new 
string[64];
        
format(string, sizeof(string), "You are spectating %s (ID: %d).", PlayerICName(giveplayerid), giveplayerid);
        
SendClientMessage(playerid, COLOR_WHITE, string);
    }    
    return 
1; //error 010: invalid function or declaration
} 
Error
PHP код:
error 010: invalid function or declaration 
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
What error?
Код:
error 010: invalid function or declaration
Reply
#3

Try replacing this line:
Код:
if( InsideTut{giveplayerid} >= 1 ) {
With this:
Код:
if( InsideTut[giveplayerid] >= 1 ) {
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)