09.02.2019, 12:12
Me again, yay!
I was trying to make a function so it can be called when a player joins a class- it will then calculate how many trucking missions they have done and display their "rank" in chat.
I call it with SetPlayerTruckerClassRank(playerid); under OnPlayerRequestClass.
In console, the printf does indeed print FUNCTION CALLED. However, the rest doesn't appear to work.
The code looks a bit messy (the forum formatted it strangely). You can also view it here: https://pastebin.com/ypFcy3J9 - Please note that this is not all of the code, it is only the first rank because it's all the same (except the numbers are different).
I was trying to make a function so it can be called when a player joins a class- it will then calculate how many trucking missions they have done and display their "rank" in chat.
Code:
SetPlayerTruckerClassRank(playerid)
{
printf("FUNCTION CALLED");
new Name[24], Msg[128];
// Get the player's name
GetPlayerName(playerid, Name, sizeof(Name));
switch(APlayerData[playerid][StatsTruckerJobs])
{
case 0:
{
if (APlayerData[playerid][StatsTruckerJobs] < 15)
{
TruckerRank = "Newbie";
format(Msg, sizeof(Msg), "{FFFF00}Newbie {FFFF00}%s{FFFF00} joined {FFFF00}Truckers", Name);
SendClientMessage(playerid, COLOR_WHITE, "{FFFF00}test");
SendClientMessage(playerid, COLOR_WHITE, "{FFFF00}test.");
}
}
In console, the printf does indeed print FUNCTION CALLED. However, the rest doesn't appear to work.
The code looks a bit messy (the forum formatted it strangely). You can also view it here: https://pastebin.com/ypFcy3J9 - Please note that this is not all of the code, it is only the first rank because it's all the same (except the numbers are different).


