SA-MP Forums Archive
Scripting Help [TEAMS/GANGS] - 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: Scripting Help [TEAMS/GANGS] (/showthread.php?tid=281925)

Pages: 1 2


Re: Scripting Help [TEAMS/GANGS] - AeroBlast - 08.09.2011

pawn Code:
forward SetPlayerTeamFromClass(playerid, classid);

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}

public SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        gTeam[playerid] = TEAM_WORKERS;
        GameTextForPlayer(playerid,"~g~Workers",10,0);
    }
    else if(classid == 1)
    {
        gTeam[playerid] = TEAM_AGENTS;
        GameTextForPlayer(playerid,"~r~Agents",10,0);
    }
    return 1;
}
Or, if you want different views at each class:
pawn Code:
forward SetPlayerTeamFromClass(playerid, classid);

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

public SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        gTeam[playerid] = TEAM_WORKERS;
        GameTextForPlayer(playerid,"~g~Workers",10,0);
        SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
        SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
        SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    }
    else if(classid == 1)
    {
        gTeam[playerid] = TEAM_AGENTS;
        GameTextForPlayer(playerid,"~r~Agents",10,0);
        SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
        SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
        SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    }
    return 1;
}



AW: Scripting Help [TEAMS/GANGS] - Santox14 - 08.09.2011

okay but if i type forward SetPlayerTeamFromClass(playerid, classid); The"forward" is not blue in my script -.-


Re: Scripting Help [TEAMS/GANGS] - AeroBlast - 08.09.2011

That doesn't matter, it should be black.


AW: Scripting Help [TEAMS/GANGS] - Santox14 - 08.09.2011

Yes it Compiles fine now , but the team spawns doesent work lol

PHP Code:
Text 
public OnPlayerSpawn(playerid)
{
{
if(GetPlayerTeam(playerid) == TEAM_AGENTS)
{
SetPlayerPos(playerid,-2136.3921,-124.4632,36.5191);//Chnage this to the spawnpoint of your Agents Team!
SetPlayerHealth(playerid,100);
}
else if(GetPlayerTeam(playerid) == TEAM_WORKERS)
{
SetPlayerHealth(playerid,100);
SetPlayerPos(playerid,-2016.3192,130.2446,27.6875);//Chnage this to the spawnpoint of your Workers Team!
}
}
return 1;
}
[/php]


AW: Scripting Help [TEAMS/GANGS] - Santox14 - 08.09.2011

hmm it wont work because:

PHP Code:

public OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("Blank Script");
    
AddPlayerClass(1051958.37831343.157215.3746269.1425000000);
    
AddPlayerClass(1061958.37831343.157215.3746269.1425000000);
    
AddPlayerClass(1071958.37831343.157215.3746269.1425000000);
    
AddPlayerClass(1021958.37831343.157215.3746269.1425000000);
    
AddPlayerClass(1031958.37831343.157215.3746269.1425000000);
    
AddPlayerClass(1041958.37831343.157215.3746269.1425000000);
     return 
1;

cause the player dont spawns on his team spawn


AW: Scripting Help [TEAMS/GANGS] - Santox14 - 08.09.2011

hmm you know why?


Re: Scripting Help [TEAMS/GANGS] - AeroBlast - 08.09.2011

Remove the
pawn Code:
{
if(GetPlayerTeam(playerid) == TEAM_AGENTS)
{
SetPlayerPos(playerid,-2136.3921,-124.4632,36.5191);//Chnage this to the spawnpoint of your Agents Team!
SetPlayerHealth(playerid,100);
}
else if(GetPlayerTeam(playerid) == TEAM_WORKERS)
{
SetPlayerHealth(playerid,100);
SetPlayerPos(playerid,-2016.3192,130.2446,27.6875);//Chnage this to the spawnpoint of your Workers Team!
}
so you only have the
pawn Code:
public OnPlayerSpawn(playerid)
{
    return 1;
}
and add
pawn Code:
AddPlayerClass(Workersskin,-2016.3192,130.2446,27.6875,0,0,0,0,0,0,0); //Change the last 6 0's to the weapon/ammo ids
AddPlayerClass(Agentsskin,-2136.3921,-124.4632,36.5191,0,0,0,0,0,0,0); //Same here
It should work


AW: Scripting Help [TEAMS/GANGS] - Santox14 - 08.09.2011

Thanks !


Re: Scripting Help [TEAMS/GANGS] - AeroBlast - 08.09.2011

Anytime =D


AW: Scripting Help [TEAMS/GANGS] - Santox14 - 08.09.2011

my last question is what are the colors for GameTextForPlayer like "~g~" i want light green for SBF gang members cause im creating a RP mode...


Re: Scripting Help [TEAMS/GANGS] - MadeMan - 08.09.2011

https://sampwiki.blast.hk/wiki/GameTextStyle


Re: Scripting Help [TEAMS/GANGS] - judothijs - 10.09.2011

~removed, didn't saw the other pages xD ~