SA-MP Forums Archive
TDM help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: TDM help (/showthread.php?tid=455268)



TDM help - DJRebis - 01.08.2013

Hello, i watched tut how to make TDM Gamemode but im gettin error:
Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
}
    SetPlayerTeamFromClass(playerid, classid)// this is not a native function
{
    switch(classid) // it switches through classids
    {
        case 0: // classid 0
        {
            gTeam[playerid] = TEAM_GROVE; // it sets the data of the player who selected the first team (in the gTeam array) to TEAM_GROVE
            {
                SetPlayerColor(playerid,TEAM_GROVE_COLOR);
            }
        }
        case 1: // classid 1
        {
            gTeam[playerid] = TEAM_BALLAS; // it sets the data of the player who selected the second team (in the gTeam array) to TEAM_BALLAS
            {
                SetPlayerColor(playerid, TEAM_BALLAS_COLOR);
            }
        }
    }
}
return 1;
}
Error:
Код:
.pwn(79) : error 010: invalid function or declaration
But in 79 line is only
Код:
return 1;
Where is prob?


Re: TDM help - S0n1COwnsYou - 01.08.2013

try this:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}

SetPlayerTeamFromClass(playerid, classid)
{
    switch(classid)
    {
        case 0:
        {
            gTeam[playerid] = TEAM_GROVE;
            SetPlayerColor(playerid,TEAM_GROVE_COLOR);
        }
        case 1:
        {
            gTeam[playerid] = TEAM_BALLAS;
            SetPlayerColor(playerid, TEAM_BALLAS_COLOR);
        }
    }
    return 1;
}



Re: TDM help - DJRebis - 01.08.2013

Quote:
Originally Posted by S0n1COwnsYou
Посмотреть сообщение
try this:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}

SetPlayerTeamFromClass(playerid, classid)
{
    switch(classid)
    {
        case 0:
        {
            gTeam[playerid] = TEAM_GROVE;
            SetPlayerColor(playerid,TEAM_GROVE_COLOR);
        }
        case 1:
        {
            gTeam[playerid] = TEAM_BALLAS;
            SetPlayerColor(playerid, TEAM_BALLAS_COLOR);
        }
    }
    return 1;
}
Thank you! Works now!