Spec Command
#1

Hello. I'm trying to make a spectator command but when I do it I get those errors.

Код:
C:\Users\9502emst\Desktop\RP Server\gamemodes\Roleplay1.pwn(36) : warning 201: redefinition of constant/macro (symbol "MAX_PLAYERS")
(41) : error 020: invalid symbol name ""
(400) : error 017: undefined symbol "SpecX"
(400) : warning 215: expression has no effect
(400) : error 001: expected token: ";", but found "]"
(400) : error 029: invalid expression, assumed zero
(400) : fatal error 107: too many error messages on one line
PHP код:
#undef
#define MAX_PLAYERS 75 
PHP код:
CMD:spec(playeridparams[])
{
    new 
id;
    if(
pInfo[playerid][pAdmin] < 1) return 0;
    if(
sscanf(params,"u"id))return SendClientMessage(playerid0x99CEFFFF"Usage: /spec [id]");
    if(
id == playerid)return SendClientMessage(playerid,0x99CEFFFF,"You cannot spec yourself.");
    if(
id == INVALID_PLAYER_ID)return SendClientMessage(playerid0x99CEFFFF"Player not found!");
    if(
IsSpecing[playerid] == 1)return SendClientMessage(playerid,0x99CEFFFF,"You are already specing someone.");
    
GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
    
Inter[playerid] = GetPlayerInterior(playerid);
    
vWorld[playerid] = GetPlayerVirtualWorld(playerid);
    
TogglePlayerSpectating(playeridtrue);
    if(
IsPlayerInAnyVehicle(id))
    {
        if(
GetPlayerInterior(id) > 0)
        {
            
SetPlayerInterior(playerid,GetPlayerInterior(id));
        }
        if(
GetPlayerVirtualWorld(id) > 0)
        {
            
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
        }
        
PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
    }
    else
    {
        if(
GetPlayerInterior(id) > 0)
        {
            
SetPlayerInterior(playerid,GetPlayerInterior(id));
        }
        if(
GetPlayerVirtualWorld(id) > 0)
        {
            
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
        }
        
PlayerSpectatePlayer(playerid,id);
    }
    
GetPlayerName(idNamesizeof(Name));
    
format(Stringsizeof(String),"You have started to spectate %s.",Name);
    
SendClientMessage(playerid,0x99CEFFFF,String);
    
IsSpecing[playerid] = 1;
    
IsBeingSpeced[id] = 1;
    
spectatorid[playerid] = id;
    return 
1;

Reply
#2

pawn Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 75
And as for the other issues show around line 400 or show us what it is.
Reply
#3

pawn Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 75

new Float:SpecX[MAX_PLAYERS], Float:SpecY[MAX_PLAYERS], Float:SpecZ[MAX_PLAYERS];
CMD:spec(playerid, params[])
{
    new id;
    if(pInfo[playerid][pAdmin] < 1) return 0;
    if(sscanf(params,"u", id))return SendClientMessage(playerid, 0x99CEFFFF, "Usage: /spec [id]");
    if(id == playerid)return SendClientMessage(playerid,0x99CEFFFF,"You cannot spec yourself.");
    if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0x99CEFFFF, "Player not found!");
    if(IsSpecing[playerid] == 1)return SendClientMessage(playerid,0x99CEFFFF,"You are already specing someone.");
    GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
    Inter[playerid] = GetPlayerInterior(playerid);
    vWorld[playerid] = GetPlayerVirtualWorld(playerid);
    TogglePlayerSpectating(playerid, true);
    if(IsPlayerInAnyVehicle(id))
    {
        if(GetPlayerInterior(id) > 0)
        {
            SetPlayerInterior(playerid,GetPlayerInterior(id));
        }
        if(GetPlayerVirtualWorld(id) > 0)
        {
            SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
        }
        PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
    }
    else
    {
        if(GetPlayerInterior(id) > 0)
        {
            SetPlayerInterior(playerid,GetPlayerInterior(id));
        }
        if(GetPlayerVirtualWorld(id) > 0)
        {
            SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
        }
        PlayerSpectatePlayer(playerid,id);
    }
    GetPlayerName(id, Name, sizeof(Name));
    format(String, sizeof(String),"You have started to spectate %s.",Name);
    SendClientMessage(playerid,0x99CEFFFF,String);
    IsSpecing[playerid] = 1;
    IsBeingSpeced[id] = 1;
    spectatorid[playerid] = id;
    return 1;
}
Make sure all variables were created command...
Reply
#4

Quote:
Originally Posted by DrTHE
Посмотреть сообщение
pawn Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 75

new Float:SpecX[MAX_PLAYERS], Float:SpecY[MAX_PLAYERS], Float:SpecZ[MAX_PLAYERS];
CMD:spec(playerid, params[])
{
    new id;
    if(pInfo[playerid][pAdmin] < 1) return 0;
    if(sscanf(params,"u", id))return SendClientMessage(playerid, 0x99CEFFFF, "Usage: /spec [id]");
    if(id == playerid)return SendClientMessage(playerid,0x99CEFFFF,"You cannot spec yourself.");
    if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0x99CEFFFF, "Player not found!");
    if(IsSpecing[playerid] == 1)return SendClientMessage(playerid,0x99CEFFFF,"You are already specing someone.");
    GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
    Inter[playerid] = GetPlayerInterior(playerid);
    vWorld[playerid] = GetPlayerVirtualWorld(playerid);
    TogglePlayerSpectating(playerid, true);
    if(IsPlayerInAnyVehicle(id))
    {
        if(GetPlayerInterior(id) > 0)
        {
            SetPlayerInterior(playerid,GetPlayerInterior(id));
        }
        if(GetPlayerVirtualWorld(id) > 0)
        {
            SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
        }
        PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
    }
    else
    {
        if(GetPlayerInterior(id) > 0)
        {
            SetPlayerInterior(playerid,GetPlayerInterior(id));
        }
        if(GetPlayerVirtualWorld(id) > 0)
        {
            SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
        }
        PlayerSpectatePlayer(playerid,id);
    }
    GetPlayerName(id, Name, sizeof(Name));
    format(String, sizeof(String),"You have started to spectate %s.",Name);
    SendClientMessage(playerid,0x99CEFFFF,String);
    IsSpecing[playerid] = 1;
    IsBeingSpeced[id] = 1;
    spectatorid[playerid] = id;
    return 1;
}
Make sure all variables were created command...
Yeah sorry I forgoted to posted them. Here they are.

PHP код:
new String[128], Float:SpecX[MAX_PLAYERS], Float:SpecY[MAX_PLAYERS], Float:SpecZ[MAX_PLAYERS], vWorld[MAX_PLAYERS], Inter[MAX_PLAYERS];
new 
IsSpecing[MAX_PLAYERS], Name[MAX_PLAYER_NAME], IsBeingSpeced[MAX_PLAYERS],spectatorid[MAX_PLAYERS]; 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)