02.11.2017, 22:02
It could probably be because your pCompany Array is at 0 or over 3, Your code only checks it if it is between 1 - 3.
I have re-write your code and add a print function show us what it prints:
I have re-write your code and add a print function show us what it prints:
PHP код:
forward unloading(playerid);
public unloading(playerid)
{
new gString[128], moneymsg[20], playerscore = GetPlayerScore(playerid);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_GREEN, "Well done! You completed the mission!");//sends the player a message
format(gString, sizeof gString, "%s has completed mission: %s", pName(playerid), iMissionText[playerid]);//formats the message
SendClientMessageToAll(COLOR_GREEN, gString);//sends everyone message saying player completed mission
MissionStatus[playerid] = 0;//sets the mission status of the player to '0'
SetPlayerScore(playerid, playerscore + 1 );
GivePlayerMoney(playerid, iPay[playerid]);
format(moneymsg, sizeof moneymsg, "~y~+%d~g~$", iPay[playerid]);
GameTextForPlayer(playerid, moneymsg, 5000, 1);
printf("Array pCompany: %i", PlayerInfo[playerid][pCompany]); // added for debugging
if(PlayerInfo[playerid][pCompany] == 1)
{
SendClientMessage(playerid, COL_POSITIVE, "Company bonus money: 3000$");
GivePlayerMoney(playerid, 3000);
}
else if(PlayerInfo[playerid][pCompany] == 2)
{
SendClientMessage(playerid, COL_POSITIVE, "Company bonus money: 6000$");
GivePlayerMoney(playerid, 6000);
}
else if(PlayerInfo[playerid][pCompany] == 3)
{
SendClientMessage(playerid, COL_POSITIVE, "Company bonus money: 12000$");
GivePlayerMoney(playerid, 12000);
}
return true;
}