Why wont this work? - 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: Why wont this work? (
/showthread.php?tid=370636)
Why wont this work? -
Dan. - 20.08.2012
Not finished yet, but it should choose 2 random teams and then send a clientmessage to all, saying which teams are chosen:
pawn Код:
forward RandomWar();
public RandomWar()
{
new string[128], team1, team2, team3;
new RandomTeams[][] =
{
{T_ENGLAND},
{T_RUSSIA},
{T_IRAQ},
{T_MEXICO}
};
team1 = random(sizeof(RandomTeams));
team2 = random(sizeof(RandomTeams));
team3 = random(sizeof(RandomTeams));
if(team1 == team2) team1 = team3;
if(team2 == team1 && team1 != team3) team2 = team3;
format(string, sizeof string, "A random war has started between team %s and %s!", TeamName(team1), TeamName(team2));
SendClientMessageToAll(C_WHITE, string);
}
The stock:
pawn Код:
stock TeamName(teamid)
{
new team[32];
if(teamid == T_ENGLAND) team = ("England");
if(teamid == T_RUSSIA) team = ("Russia");
if(teamid == T_IRAQ) team = ("Iraq");
if(teamid == T_MEXICO) team = ("Mexico");
return team;
}
And in game it prints:
pawn Код:
A random war has started between team and !
Re: Why wont this work? -
RicaNiel - 20.08.2012
try doing it as value
and define each value as team
might work
i hate string's kuje strcmp i cant get it work
Re: Why wont this work? -
Dan. - 20.08.2012
Also giving a warning:
pawn Код:
warning 204: symbol is assigned a value that is never used: "RandomTeams"
I'd like to get it work in this way.
Re: Why wont this work? -
RicaNiel - 20.08.2012
Quote:
Originally Posted by Dan.
Also giving a warning:
pawn Код:
warning 204: symbol is assigned a value that is never used: "RandomTeams"
I'd like to get it work in this way.
|
Maybe you have define it and you havent used it
Re: Why wont this work? -
Dan. - 21.08.2012
Well I have used it, haven't I?
pawn Код:
team1 = random(sizeof(RandomTeams));