SA-MP Forums Archive
Question +rep - 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: Question +rep (/showthread.php?tid=600969)



Question +rep - Banditul18 - 15.02.2016

Hello, i have a question: how to make this:
Код:
stock GetPlayerRank(playerid)
{
	new rank[64];
	new tirist = APlayerData[playerid][StatsTruckerJobs];
	
	if(tirist >= 0 && tirist <= 50) rank = "Rookie Trucker";
	else if (tirist >= 51 && tirist <= 100) rank = "Good Trucker";
	else if (tirist >= 101 && tirist <= 150) rank = "Very Good Trucker";
	else if (tirist >= 151 && tirist <= 250) rank = "Expert Trucker";
	else if (tirist >= 251 && tirist <= 500) rank = "The Best Trucker";
	else if (tirist >= 501) rank = "King of the Road";
	
	return rank;
}
to do this:
Код:
GetPlayerRank(playerid, rank, sizeof(rank));
I mean to work is working, but give me warning:
Код:
warning 202: number of arguments does not match definition
I someone know please reply....


Re: Question +rep - GhostHacker - 15.02.2016

that warning is not a problem


Re: Question +rep - J0sh... - 15.02.2016

PHP код:
stock GetPlayerRank(playeridrank[], len sizeof(rank))
{
    new 
tirist APlayerData[playerid][StatsTruckerJobs];
    
    if(
tirist >= && tirist <= 50) return strcat(rank"Rookie Trucker"len);
    else if (
tirist >= 51 && tirist <= 100) return strcat(rank"Good Trucker"len);
    else if (
tirist >= 101 && tirist <= 150) return strcat(rank"Very Good Trucker"len);
    else if (
tirist >= 151 && tirist <= 250) return strcat(rank"Expert Trucker"len);
    else if (
tirist >= 251 && tirist <= 500) return strcat(rank"The Best Trucker"len);
    else if (
tirist >= 501) return strcat(rank"King of the Road"len);
    
    return 
0;




Re: Question +rep - valych - 15.02.2016

@GhostHacker, actually it is.
@Banditul18, you should define your function in this way:
PHP код:
stock GetPlayerRank(playeridrank[], len)
{
    new 
tirist APlayerData[playerid][StatsTruckerJobs];
    
    if(
tirist >= && tirist <= 50format(ranklen"Rookie Trucker");
    else if (
tirist >= 51 && tirist <= 100format(ranklen"Good Trucker");
    else if (
tirist >= 101 && tirist <= 150format(ranklen"Very Good Trucker");
    else if (
tirist >= 151 && tirist <= 250format(ranklen"Expert Trucker");
    else if (
tirist >= 251 && tirist <= 500format(ranklen"The Best Trucker");
    else if (
tirist >= 501format(ranklen"King of the Road");
    return 
1;

Then, whenever you need to get a string of a player's rank:
PHP код:
new rank[64];
GetPlayerRank(playeridranksizeof(rank));
// And lets output the rank (just for an example)
new string[64];
format(stringsizeof(string), "Your rank is: %s"rank);
SendClientMessage(playerid, -1string); 
//Edit: didn't noticed that someone has already gave an answer


Re: Question +rep - MicroKyrr - 15.02.2016

Quote:
Originally Posted by GhostHacker
Посмотреть сообщение
that warning is not a problem
He's asking a question.