Need Help With Basic Checkpoints. -
Bofhead - 20.06.2009
Hi i am trying to code a checkpoint to appear when someone gets into a truck (id= 515). This is my code.
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (vehicleid == 515)
{
SetPlayerCheckpoint(playerid,2385.4553,28.5155,26.4844, 10);
}
else {
SendClientMessage(playerid, 0xffffffAA, "Not The Right Vehicle");
}
return 1;
}
Can anyone see the problem?
Thanks in advance,
Josh
Re: Need Help With Basic Checkpoints. -
Abernethy - 20.06.2009
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (GetVehicleModel(playerid) == 515)
{
SetPlayerCheckpoint(playerid,2385.4553,28.5155,26.4844, 10);
}
return 1;
}
No need for the "This isn't the right vehicle". That should work, I use the same thing, but I send the Client a Message instead of a checkpoint.
Re: Need Help With Basic Checkpoints. -
Bofhead - 20.06.2009
Thanks for the reply but this still isn't working? Anyideas?
Thanks Josh
Re: Need Help With Basic Checkpoints. -
CracK - 20.06.2009
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (GetVehicleModel(vehicleid) == 515)
{
SetPlayerCheckpoint(playerid,2385.4553,28.5155,26.4844, 10);
}
return 1;
}
Re: Need Help With Basic Checkpoints. -
Bofhead - 20.06.2009
Thankyou so much, it works.
Is there anyway to set 5 different checkpoints and have the checkpoint shown to the player randomly selected out of the 5 checkpoints? I want to set up trucking missions but i don't want only 1 route.
Thanks again,
Josh
Re: Need Help With Basic Checkpoints. -
Grim_ - 20.06.2009
If i understood you correctly:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(vehicleid)== 515)
{
new cp = random(6);
switch(cp)
{
case 0: SetPlayerCheckpoint(playerid, x, y, z);
case 1: SetPlayerCheckpoint(playerid, x, y, z);
case 2: SetPlayerCheckpoint(playerid, x, y, z);
case 3: SetPlayerCheckpoint(playerid, x, y, z);
case 4: SetPlayerCheckpoint(playerid, x, y, z);
}
}
return 1;
}
Re: Need Help With Basic Checkpoints. -
CracK - 20.06.2009
pawn Код:
//top of the script
new Float:checkpoints[][] = {
{-22.2549,-55.6575,1003.5469,2.0}, // your x,y,z,radius
{295.7192,-80.4445,1001.5156,5.0},
{-1957.5327,300.2131,35.4688,2.0}
};
//somewhere it the script, where you want to set a checkpoint
new rand = random(sizeof(checkpoints));
SetPlayerCheckpoint(playerid,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],checkpoints[rand][3]);
Re: Need Help With Basic Checkpoints. -
Bofhead - 20.06.2009
Thanks you alot everyone who posted. I am new to scripting and this really helped.
Untill next time,
Josh
Re: Need Help With Basic Checkpoints. -
Bofhead - 20.06.2009
Another quick question, Is there anyway to code it so that if the player gets out of the truck they have 30 secs (a countdown timer displayed) untill checkpoint dissapers. Also how do i set it so they can only enter the checkpoint if they are in a truck with a trailer?
Thanks in advance,
Josh
Re: Need Help With Basic Checkpoints. -
CracK - 21.06.2009
It belongs more to
this topic.
Anyway, for a countdown use
search.
About vehicle with trailer attached:
pawn Код:
if(GetVehicleTrailer(GetPlayerVehicleID(playerid)))
or:
pawn Код:
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))