Random war script - 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: Random war script (
/showthread.php?tid=502994)
Random war script -
Recko - 27.03.2014
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: Random war script -
iThePunisher - 27.03.2014
try this
pawn Код:
if(team1 == team2) team1 = team3;
if(team2 == team1 && team1 != team3) team2 = team3;
format(string, sizeof string, "A random war has started between team %d and %d!", TeamName(team1), TeamName(team2));
SendClientMessageToAll(C_WHITE, string);
}
Re: Random war script -
Konstantinos - 27.03.2014
It prints the teams' names fine for me and by the way, you don't need a 2D array.
@iThePunisher: It returns an array/string, not an integer so the placeholder you used is wrong.
Re : Random war script -
Recko - 27.03.2014
not work, help please!
Re : Random war script -
Recko - 27.03.2014
Now i have this error
warning 204: symbol is assigned a value that is never used: "RandomTeams"
Re : Random war script -
Recko - 27.03.2014
help
Re : Random war script -
Recko - 27.03.2014
please
Re: Random war script -
iZN - 27.03.2014
Bumping thread everytime will not help you. It will only give you a free infraction.
Try this?
pawn Код:
stock TeamName(teamid)
{
new team[32];
switch(teamid)
{
case T_ENGLAND: format(team, sizeof(team), "England");
case T_RUSSIA: format(team, sizeof(team), "Russia");
case T_IRAQ: format(team, sizeof(team), "Iraq");
case T_MEXICO: format(team, sizeof(team), "Mexico");
}
return team;
}
Re: Re : Random war script -
BroZeus - 27.03.2014
Quote:
Originally Posted by Recko
Now i have this error
warning 204: symbol is assigned a value that is never used: "RandomTeams"
|
ignore that warning
The warning means that a symbol is there which is never used
for example i do a=5; and not use 'a' anywhere in the program so i will get this warning that 'a' is never used
Re : Random war script -
Recko - 27.03.2014
thanks but still the same problem in game with
A random war has started between team and !
iZn your code don't work