OnPlayerSpawn Compiling error
#1

Hey
pawn Код:
public OnPlayerSpawn(playerid,classid)
{
    if(classid == 0)
    {
        SetPlayerInterior(playerid,0);
        SetPlayerPos(playerid,2004.93,1544.25,13.59);
        SetPlayerFacingAngle(playerid,270.0);
        SetPlayerToTeamColour(playerid);
        SetPlayerTeamFromClass(playerid, classid);
    }
    return 1;
}
ERROR
pawn Код:
D:\SAMP\Server\gamemodes\SERVER.pwn(78) : error 025: function heading differs from prototype
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Hmm, help?
Reply
#2

It's just OnPlayerSpawn(playerid), there is no classid parameter.

for them you should do something like

pawn Код:
new Class[MAX_PLAYERS];

public OnPlayerRequestClass(playerid, classid)
{
    // Your other code
    Class[playerid] = classid;
}

public OnPlayerSpawn(playerid)
{
    if(Class[playerid] == 0)
    {
        SetPlayerInterior(playerid,0);
        SetPlayerPos(playerid,2004.93,1544.25,13.59);
        SetPlayerFacingAngle(playerid,270.0);
        SetPlayerToTeamColour(playerid);
        SetPlayerTeamFromClass(playerid, classid);
    }
    return 1;
}
Reply
#3

Another error
pawn Код:
D:\SAMP\Server\gamemodes/SERVER.pwn(90) : error 017: undefined symbol "classid"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase

1 Error.
Reply
#4

Quote:
Originally Posted by _Khaled_
Посмотреть сообщение
Another error
Show me the whole public() including line 90.
Reply
#5

pawn Код:
//==============================================================================
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid,COLOR_GREEN,"Welcome to ********");
    return 1;
}
//==============================================================================
public OnGameModeInit()
{
    SetGameModeText("Cops and Criminals");
    AddPlayerClass(2, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
   
    AddPlayerClass(265, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
   
    AddPlayerClass(287, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}
//==============================================================================
public OnPlayerRequestClass(playerid, classid)
{
    Class[playerid] = classid;
    SetPlayerInterior(playerid,3);
    SetPlayerPos(playerid,944.99,-41.64,1001.77);
    SetPlayerFacingAngle(playerid,180.0);
    SetPlayerCameraPos(playerid,944.69,-47.54,1001.12);
    SetPlayerCameraLookAt(playerid,944.99,-41.64,1001.77);
    if(classid == 0)
    {
        SetPlayerTeamFromClass(playerid, classid);
        GameTextForPlayer(playerid,"~w~CIVILIAN",1000,4);
    }
    if(classid == 1)
    {
    SetPlayerTeamFromClass(playerid, classid);
        GameTextForPlayer(playerid,"~b~COP",1000,4);
    }
    if(classid == 2)
    {
        SetPlayerTeamFromClass(playerid, classid);
        GameTextForPlayer(playerid,"~g~ARMY",1000,4);
    }
    return 1;
}
//==============================================================================
public OnPlayerSpawn(playerid)
{
    if(Class[playerid] == 0)
    {
        SetPlayerInterior(playerid,0);
        SetPlayerPos(playerid,2004.93,1544.25,13.59);
        SetPlayerFacingAngle(playerid,270.0);
        SetPlayerToTeamColour(playerid);
        SetPlayerTeamFromClass(playerid, classid);
    }
    //Will add spawn points for cops and Army later.
    return 1;
}
//==============================================================================
public OnPlayerDeath(playerid)
{
        SetPlayerInterior(playerid,0);
    SetPlayerPos(playerid,2004.93,1544.25,13.59);
    SetPlayerFacingAngle(playerid,270.0);
        SetPlayerToTeamColour(playerid);
    GivePlayerMoney(playerid, -100);
    return 1;
}
Reply
#6

pawn Код:
//AFTER I ADDED THE       /*>>>>if(class[playerid] == 0)<<<<*/, check compiling error
public OnPlayerDeath(playerid)
{
    if(Class[playerid] == 0)
    {
        SetPlayerInterior(playerid,0);
        SetPlayerPos(playerid,2004.93,1544.25,13.59);
        SetPlayerFacingAngle(playerid,270.0);
        SetPlayerToTeamColour(playerid);
        SetPlayerTeamFromClass(playerid, classid);
        GivePlayerMoney(playerid,-100);
   }
   //will add things of cops and army later.
   return 1;
}
New compiling error
pawn Код:
D:\SAMP\Server\SACNC\gamemodes\SACNC.pwn(88) : error 017: undefined symbol "classid"
D:\SAMP\Server\SACNC\gamemodes\SACNC.pwn(101) : error 017: undefined symbol "classid"
D:\SAMP\Server\SACNC\gamemodes\SACNC.pwn(105) : warning 217: loose indentation
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Help dudes?
Reply
#7

try.. #include <a_samp>
Reply
#8

Quote:
Originally Posted by Tuntun
Посмотреть сообщение
try.. #include <a_samp>
LOL It's there.

pawn Код:
#include <a_samp>
//==============================================================================
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//Colours
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_DEADCONNECT 0x808080AA
#define COLOR_BLUE 0x0000FFAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_ERROR 0xD2691EAA
#define COLOR_PINK 0xFF0080FF
//==============================================================================
//==============================================================================
#define TEAM_CIVIL 0
#define TEAM_COP 1
#define TEAM_ARMY 2

#define TEAM_CIVIL_COLOUR 0xFFFFFFAA
#define TEAM_COP_COLOUR 0x0000FFAA
#define TEAM_ARMY_COLOUR 0x33AA33AA
Reply
#9

try
#include <a_samp>

public OnPlayerSpawn(playerid,classid)
{
if(classid == 0)
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,2004.93,1544.25,13.59);
SetPlayerFacingAngle(playerid,270.0);
SetPlayerToTeamColour(playerid);
SetPlayerTeamFromClass(playerid, classid);
}
return 1;
}
Reply
#10

Quote:
Originally Posted by Tuntun
Посмотреть сообщение
try
#include <a_samp>

public OnPlayerSpawn(playerid,classid)
{
if(classid == 0)
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,2004.93,1544.25,13.59);
SetPlayerFacingAngle(playerid,270.0);
SetPlayerToTeamColour(playerid);
SetPlayerTeamFromClass(playerid, classid);
}
return 1;
}
Error while compiling
pawn Код:
D:\SAMP\Server\SACNC\gamemodes\SACNC.pwn(94) : error 025: function heading differs from prototype
D:\SAMP\Server\SACNC\gamemodes\SACNC.pwn(115) : error 017: undefined symbol "classid"
D:\SAMP\Server\SACNC\gamemodes\SACNC.pwn(119) : warning 217: loose indentation
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)