27.07.2013, 11:11
Quote:
|
So basically it's just like the code you gave us, but when the mission ends, you must do this:
pawn Код:
![]() |
Код:
stock CheckpointEntered(playerid)
{
new string[300];
new vID = GetPlayerVehicleID(playerid);//Explained earlier
if(!IsTrailerAttachedToVehicle(vID)) return SendClientMessage(playerid, COLOR_WHITE, "You need a trailer to unload!");//This line checks wether the player has a trailer attached to their truck.
if(T_OnMission[playerid] == 1)//checks the players mission status
{
DisablePlayerCheckpoint(playerid);//disables the checkpoint
SetPlayerCheckpoint(playerid, unx[playerid], uny[playerid], unz[playerid], 7);//creates the new checkpoint from the saved positions we made earlier
SendClientMessage(playerid, COLOR_WHITE, "Loaded. Please head to the second checkpoint!");//sends message
T_OnMission[playerid] = 2;//sets the players mission status
}
else if(T_OnMission[playerid] == 2)//checks the mission status of the player
{
if(iPay[playerid] < 10001){
iScore[playerid] = 1;
}
else if(iPay[playerid] < 20001){
iScore[playerid] = 2;
}
else if(iPay[playerid] > 20000){
iScore[playerid] = 3;
}
format(string,sizeof(string),"Well done. You have completed your mission and earned %d$ and %d score.",iPay[playerid]*5,iScore[playerid]);
TextDrawSetString(Textdraw0[playerid]," You are currently not on mission. Use /work to start working.");
GivePlayerMoney(playerid,iPay[playerid]*5);
SendClientMessage(playerid, COLOR_YELLOW, string);
new string2[256],name[30];
GetPlayerName(playerid,name,sizeof(name));
format(string2, sizeof(string2), "%s has delivered %s!", name, MisLocations[MisRand][LoadName]); //line 296
SendClientMessageToAll(COLOR_YELLOW, string2);
DisablePlayerCheckpoint(playerid);//disables the checkpoint
T_OnMission[playerid] = 0;
SetPlayerScore(playerid, GetPlayerScore(playerid)+iScore[playerid]);//gives the player 2 score
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_Close(File);
}
return 1;
}
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.



