Error Help
#1

I just started getting back to scripting from a long time, and I'm using the tutorial bellow (link posted) to try to script the basic part of a TDM script I'm making.

Tutorial I'm using:
https://sampforum.blast.hk/showthread.php?tid=418054

So, I just entered/completed all of the steps, and have finished with the following errors:
pawn Код:
C:\Users\????\Documents\samp03x_svr_R1-2_win32\gamemodes\HTDM.pwn(41) : error 017: undefined symbol "LoadVehicles"
C:\Users\????\Documents\samp03x_svr_R1-2_win32\gamemodes\HTDM.pwn(70) : error 029: invalid expression, assumed zero
C:\Users\????\Documents\samp03x_svr_R1-2_win32\gamemodes\HTDM.pwn(81) : error 029: invalid expression, assumed zero
C:\Users\????\Documents\samp03x_svr_R1-2_win32\gamemodes\HTDM.pwn(90) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\????\Documents\samp03x_svr_R1-2_win32\gamemodes\HTDM.pwn(90 -- 91) : error 028: invalid subscript (not an array or too many subscripts): "playerid"
C:\Users\????\Documents\samp03x_svr_R1-2_win32\gamemodes\HTDM.pwn(90 -- 92) : error 001: expected token: "}", but found "if"
C:\Users\????\Documents\samp03x_svr_R1-2_win32\gamemodes\HTDM.pwn(90 -- 92) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


7 Errors.
Now, here's what the script so far looks like:
pawn Код:
LoadVehicles();
    AddPlayerClass( 0, 2195.4729, 1688.1770, 12.3672, 266.4879, 30, 10000, 28, 10000, 24, 10000 ); // *Criminal Class 1*
    AddPlayerClass( 78, 2195.8218, 1685.8918, 12.3672, 266.4879, 27, 10000, 31, 10000, 32, 10000 ); // *Criminal Class 2*
    AddPlayerClass( 285, 2281.4963, 2467.0193, 3.5313, 182.1925, 31, 10000, 27, 10000, 29, 10000 ); // *Police Class 1*
    return 1;
}

//=====================
// --> Gamemode Exit <--
//=====================
public OnGameModeExit()
{
    return 1;
}

//=====================
// --> Request Class <--
//=====================
public OnPlayerRequestClass( playerid, classid )
{
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}
SetPlayerTeamFromClass(playerid, classid)
{
    switch(classid)
    {
        case 0, 1:
        {
            gTeam[playerid] = TEAM_CRIMINALS;
            GameTextForPlayer(playerid, "~r~CRIMINALS", 3000, 4);
            SetPlayerPos(playerid, 2180.4934, 1676.8185, 11.1197);
            SetPlayerInterior(playerid, 0);
            SetPlayerCameraPos(playerid, 2189.2839, 1677.0737, 11.1197);
            SetPlayerCameraLookAt(playerid, 2180.4934, 1676.8185, 11.1197);
            SetPlayerColor(playerid, RED);
            return 1;
        }
        case 2, 3:
        {
            gTeam[playerid] = TEAM_POLICE;
            GameTextForPlayer(playerid, "~b~POLICE", 3000, 4);
            SetPlayerPos(playerid, 2353.5962, 2405.6279, 10.8203);
            SetPlayerInterior(playerid, 0);
            SetPlayerCameraPos(playerid, 2361.3018, 2405.6365, 10.8203);
            SetPlayerCameraLookAt(playerid, 2353.5962, 2405.6279, 10.8203);
            SetPlayerColor(playerid, BLUE);
            return 1;
        }
        SetPlayerToTeamColor(playerid)
{
    if(gTeam[playerid] == TEAM_CRIMINALS)
    {
        SetPlayerColor(playerid, RED);
    }
    else if(gTeam[playerid] == TEAM_POLICE)
    {
        SetPlayerColor(playerid, BLUE);
    }
Can someone please tell me what I did wrong, and how I can fix it? Thanks..
The person to tell me what I did wrong, and how I can fix it, and works will receive a reputation for dedicating their time to help me fix my problem.
Reply
#2

pawn Код:
public OnGameModeInit()
{
    AddPlayerClass( 0, 2195.4729, 1688.1770, 12.3672, 266.4879, 30, 10000, 28, 10000, 24, 10000 );  // Criminal Class   1
    AddPlayerClass( 78, 2195.8218, 1685.8918, 12.3672, 266.4879, 27, 10000, 31, 10000, 32, 10000 ); // Criminal Class   2
    AddPlayerClass( 285, 2281.4963, 2467.0193, 3.5313, 182.1925, 31, 10000, 27, 10000, 29, 10000 ); // Police Class     1
    //You haven't defined LoadVehicles so I removed it
    //These all needed to be under OnGameModeInit which it looks like you forgot
    return 1;
}

public OnPlayerRequestClass( playerid, classid )
{
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}

SetPlayerTeamFromClass(playerid, classid)
{
    switch(classid)
    {
        case 0, 1:
        {
            gTeam[playerid] = TEAM_CRIMINALS;
            GameTextForPlayer(playerid, "~r~CRIMINALS", 3000, 4);
            SetPlayerPos(playerid, 2180.4934, 1676.8185, 11.1197);
            SetPlayerInterior(playerid, 0);
            SetPlayerCameraPos(playerid, 2189.2839, 1677.0737, 11.1197);
            SetPlayerCameraLookAt(playerid, 2180.4934, 1676.8185, 11.1197);
            SetPlayerColor(playerid, RED);
            return 1;
        }
        case 2, 3:
        {
            gTeam[playerid] = TEAM_POLICE;
            GameTextForPlayer(playerid, "~b~POLICE", 3000, 4);
            SetPlayerPos(playerid, 2353.5962, 2405.6279, 10.8203);
            SetPlayerInterior(playerid, 0);
            SetPlayerCameraPos(playerid, 2361.3018, 2405.6365, 10.8203);
            SetPlayerCameraLookAt(playerid, 2353.5962, 2405.6279, 10.8203);
            SetPlayerColor(playerid, BLUE);
            return 1;
        }
        //You had a function here which is still inside of the switch statement
    }
    //It should be down here, but I removed it because it was redundant because of the following.
    if(gTeam[playerid] == TEAM_CRIMINALS)
        SetPlayerColor(playerid, RED);
    else if(gTeam[playerid] == TEAM_POLICE)
        SetPlayerColor(playerid, BLUE);

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)