From soldier to go to general ... when a certain score reached .. how ? -
AlbanianGuy - 18.02.2010
Hello , I was wandering if i could make a thing like this .
When a person in a team .. lets say in the soldier team .. when he reaches a certain score ... he changes team automaticly , and goes to the general team .
Re: From soldier to go to general ... when a cerati score reached .. how ? -
Norn - 18.02.2010
Use a timer.
Re: From soldier to go to general ... when a cerati score reached .. how ? -
chosen - 18.02.2010
I think you can do this with a timer:
pawn Code:
new score = GetPlayerScore(playerid);
if(score == x)
{
if(gTeam[playerid] != TEAM_GENERAL) //your team here
{
gTeam[playerid] = TEAM_GENERAL; //your team here
}
}
Re: From soldier to go to general ... when a cerati score reached .. how ? -
AlbanianGuy - 18.02.2010
Quote:
Originally Posted by chosen
I think you can do this with a timer:
pawn Code:
new score = GetPlayerScore(playerid); if(score == x) { if(gTeam[playerid] != TEAM_GENERAL) //your team here { gTeam[playerid] = TEAM_GENERAL; //your team here } }
|
do i put to the first Team_general .. the Team_soldier ? or leave it like that ? So if i leave it that way .. everyone with the certain score will become general ..... and it will be messed up ..and where do i put this ?
Re: From soldier to go to general ... when a cerati score reached .. how ? -
chosen - 18.02.2010
Quote:
Originally Posted by AlbanianGuy
Quote:
Originally Posted by chosen
I think you can do this with a timer:
pawn Code:
new score = GetPlayerScore(playerid); if(score == x) { if(gTeam[playerid] != TEAM_GENERAL) //your team here { gTeam[playerid] = TEAM_GENERAL; //your team here } }
|
do i put to the first Team_general .. the Team_soldier ? or leave it like that ? So if i leave it that way .. everyone with the certain score will become general ..... and it will be messed up ..and where do i put this ?
|
My mistake.
pawn Code:
new score = GetPlayerScore(playerid);
if(score >= x)
{
if(gTeam[playerid] == TEAM_SOLDIER) //soldier team here
{
gTeam[playerid] = TEAM_GENERAL; //general team here
}
}
In top of your script near the other 'new' put:
Make a new function like '
public AutoCheck()' and forward it.
Inside your new function 'public AutoCheck()' put that code with teams(general/soldier).
Inside the OnGameModeInit callback put:
pawn Code:
check = SetTimer("AutoCheck", 1000, 1);
And Inside the OnGameModeExit callback:
Re: From soldier to go to general ... when a cerati score reached .. how ? -
AlbanianGuy - 18.02.2010
but where do i put the thing with sildier and general ... ?
Re: From soldier to go to general ... when a cerati score reached .. how ? -
[nl]daplayer - 18.02.2010
Hi AlbanianGuy,
There are 3 methods (maybe more) to reach the thing you want to do:
1. You can use a timer like this:
pawn Code:
// Place somewhere in your script
forward soldierScoreCheck();
public soldierScoreCheck()
{
for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
new score = GetPlayerScore(playerid);
if(score == x) // see note at the bottom of the code
{
if(gTeam[playerid] == TEAM_SOLDIER) //your team here
{
gTeam[playerid] = TEAM_GENERAL; //your team here
}
}
}
}
// Put this in OnGameModeInit
SetTimer("soldierScoreCheck", 1000, 1);
Note: Replace x to the score the score when you want people to upgrade to general.
2. You can do it in OnPlayerUpdate:
pawn Code:
public OnPlayerUpdate(playerid)
{
new score = GetPlayerScore(playerid);
if(score == x) // see note at the bottom of the code
{
if(gTeam[playerid] == TEAM_SOLDIER) //your team here
{
gTeam[playerid] = TEAM_GENERAL; //your team here
}
}
}
Note: Replace x to the score the score when you want people to upgrade to general.
3. You can use a custom check you run every time you change a players score:
pawn Code:
stock soldierScoreCheck(playerid)
{
new score = GetPlayerScore(playerid);
if(score == x) // see note at the bottom of the code
{
if(gTeam[playerid] == TEAM_SOLDIER) //your team here
{
gTeam[playerid] = TEAM_GENERAL; //your team here
}
}
}
// and then when you change a players score:
// Example:
SetPlayerScore(playerid, x);
soldierScoreCheck(playerid);
Note: Replace x to the score the score when you want people to upgrade to general.
Witch one is the best?
1. Option 3
2. Option 1
3. Option 2
You can try all of them and look for the one that fits you the best
There could be some minor typo's here...
I hope i helped you with your problem.
Sorry, if i confused you with the order of the options.
Goodluck
Re: From soldier to go to general ... when a cerati score reached .. how ? -
AlbanianGuy - 18.02.2010
Thank you very much .. and i got another question .. when a player has become general ... and then he logsout and relogs gain .. how to make him resapwn as a general .. so he cant choose the soldier team ..
Re: From soldier to go to general ... when a cerati score reached .. how ? -
AlbanianGuy - 18.02.2010
Hey doompy .. look i havea login system .. and i just want and i have the /stats thing .. but how to save teh player's team ? can you help me with this one ? i realy need it .
Re: From soldier to go to general ... when a cerati score reached .. how ? -
[nl]daplayer - 18.02.2010
If you are using an already created gamemode like Public Enemy #1 and Godfather, it will save already.
If you are using a custom made. Then you could make it on your one.
But if you're are using a stand-alone, copy and paste login/register system in your gamemode. Then I need a piece of your saving system so i could make an example
of how to save the team.
Or do you mean how to disable a skin for a team?