GetPlayerTeamName custom function doesn't 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: GetPlayerTeamName custom function doesn't work (
/showthread.php?tid=650923)
GetPlayerTeamName custom function doesn't work -
stormchaser206 - 09.03.2018
Код:
GetPlayerTeamName(playerid)
{
new szString[24];
new team;
team = GetPlayerTeam(playerid);
switch(team)
{
case 5000: szString = "United States";
case 5001: szString = "Canada";
case 5002: szString = "Britain";
case 5003: szString = "Australia";
case 5004: szString = "Russia";
case 5005: szString = "Germany";
case 5006: szString = "Italy";
case 5007: szString = "France";
case 5008: szString = "China";
case 5009: szString = "India";
}
return szString;
}
I have that as a custom function but whenever I use it, it doesn't put anything in-game. Just blank.
Example:
https://i.imgur.com/ZTBoUHJ.png
The team name should be at the end.
Re: GetPlayerTeamName custom function doesn't work -
KayJ - 10.03.2018
Why do you use cases in large numbers?
Re: GetPlayerTeamName custom function doesn't work -
stormchaser206 - 10.03.2018
Quote:
Originally Posted by KayJ
Why do you use cases in large numbers?
|
Because someone else here suggested it. Those are just the team IDs.
Re: GetPlayerTeamName custom function doesn't work -
Stuntff - 10.03.2018
Код:
new const gTeamName[10][15] =
{
"United States",
"Canada",
"Britain",
"Australia",
"Russia",
"Germany",
"Italy",
"France",
"China",
"India"
};
printf("team name = %s", gTeamName[GetPlayerTeam(playerid)-5000]);
No?
Re: GetPlayerTeamName custom function doesn't work -
stormchaser206 - 11.03.2018
Is there any way I can keep my custom function?
Re: GetPlayerTeamName custom function doesn't work -
Sew_Sumi - 11.03.2018
There's no point to your function if you use the method he's shown.
You could integrate what he's shown into your function, but it sort of defeats the purpose of the method he's shown you in the first place.
Re: GetPlayerTeamName custom function doesn't work -
Dayrion - 11.03.2018
Use strcat instead of equal sign. This is a string, not a number.