03.03.2012, 21:40
(
Последний раз редактировалось SnG.Scot_MisCuDI; 03.03.2012 в 22:28.
)
Im making a truck driving script and i want it to set another checkpoint as the player enters the first.
I made it so when he enters the checkpoint it removes the map icon and checkpoint, but i want it to make a new checkpoint and the next location, then the next and return it back to the first location. So here is how the checkpoints are made. Each time you do /truckjob it makes a new checkpoint at one of the three locations.
But after you go to the first location it should make a new checkpoint at location 2 .. then 3 then back to 1
Ok so. Say you do /truckjob It will make the first checkpoint. You drive into that first checkpoint, you get the cash, and the first checkpoint is gone. Now the Second checkpoint appears and you drive to that and get cash, second checkpoint is gone. Now a third checkpoint appears and you drive and get cash. Then the third checkpoint is gone and the FIRST checkpoint comes up again and it loops through all 3 over and over over.
I made it so when he enters the checkpoint it removes the map icon and checkpoint, but i want it to make a new checkpoint and the next location, then the next and return it back to the first location. So here is how the checkpoints are made. Each time you do /truckjob it makes a new checkpoint at one of the three locations.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/truckjob", cmdtext, true, 10) == 0)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 403)
{
if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))){ SendClientMessage(playerid,COLOR_RED,"* You don't have a trailer attached to the vehicle!"); DisablePlayerCheckpoint(job); RemovePlayerMapIcon(playerid,1); return 1; }
if(PetrolJob[playerid] != 1 && PetrolJob[playerid] != 2 && PetrolJob[playerid] != 3){ PetrolJob[playerid] = 1; }
new name[MAX_PLAYER_NAME], string[48], str[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "* %s is now a Petrol Trucker.", name );
SendClientMessageToAll(COLOR_YELLOW, string);
format(str, sizeof(str), "* Drive to the yellow marker on your map");
SendClientMessage(playerid,COLOR_YELLOW, str);
if(PetrolJob[playerid] == 1){
PetrolJob[playerid] = 2;
job = SetPlayerCheckpoint(playerid, 1944.7424,-1771.1267,13.1157, 10.0);
SetPlayerMapIcon(playerid, 1, 1944.7424,-1771.1267,13.1157,56, 0, MAPICON_GLOBAL);
return 1;
}
if(PetrolJob[playerid] == 2){
PetrolJob[playerid] = 3;
job = SetPlayerCheckpoint(playerid,1003.4263,-941.8485,41.8079,10);
SetPlayerMapIcon( playerid, 1, 1003.4263,-941.8485,41.8079,56, 0,MAPICON_GLOBAL);
return 1;
}
if(PetrolJob[playerid] == 3){
PetrolJob[playerid] = 1;
job = SetPlayerCheckpoint(playerid,-97.8173,-1166.7585,2.2650,10);
SetPlayerMapIcon( playerid, 1, -97.8173,-1166.7585,2.2650,56, 0, MAPICON_GLOBAL);
return 1;
}
return 1;
}
SendClientMessage(playerid, COLOR_RED,"You have to be in a courier truck to start the job"); DisablePlayerCheckpoint(job); RemovePlayerMapIcon(playerid,1);
}
return 0;
}
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 403)
{
if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))){ SendClientMessage(playerid,COLOR_RED,"* You don't have a trailer attached to the vehicle!"); DisablePlayerCheckpoint(job); RemovePlayerMapIcon(playerid,1); return 1; }
GivePlayerMoney(playerid,50000);
SendClientMessage(playerid,COLOR_YELLOW,"* You have earned $50,000!");
RemovePlayerMapIcon(playerid,1);
DisablePlayerCheckpoint(job);
}
return 1;
}