Checkpoint adding ! REP +1 !! -
Avi57 - 31.03.2012
Guys i made this:
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Mission Checkpoints");
print("--------------------------------------\n");
#include <a_samp>
new Airports[][][] {
{ "Las Venturas Gate 1", "1577.2006", "1504.4862", "10.8342" }
{ "Las Venturas Gate 2", "1575.7137", "1390.3827", "10.8493" }
{ "Los Santos Gate 1", "1560.2095", "-2415.1707", "13.5547" }
{ "Los Santos Gate 2", "1642.4600", "-2407.6489", "13.5547" }
{ "Los Santos Gate 3", "1723.5370", "-2412.3101", "13.5547" }
{ "San Fierro Gate 1", "-1357.4568", "-243.0007", "14.1440" }
{ "San Fierro Gate 2", "-1305.0311", "-411.8734", "14.1440" }
};
new PlayerOnMission[Max_Players];
public OnPlayerConnect(playerid) {
PlayerOnMission[playerid] = 0;
return true;
}
public OnPlayerDisconnect(playerid, reason) {
PlayerOnMission[playerid] = 0;
return true;
}
public OnPlayerEnterVehicle(playerid, vehicleid) {
switch(GetVehicleModel(vehicleid)) {
case 519, 577, 592: {
new Message[100],
RandomAirport = rand(sizeof(Airports));
format(Message, 100, "A checkpoint has been set at %s!", Airports[RandomAirport][0]);
SendClientMessage(playerid, -1, "Loading Passengers!");
SetPlayerCheckpoint(playerid, floatstr(Airports[RandomAirport][1]), floatstr(Airports[RandomAirport][2]), floatstr(Airports[RandomAirport][3]));
PlayerOnMission[playerid] = 1;
}
}
return true;
}
public OnPlayerEnterCheckpoint(playerid) {
if(PlayerOnMission[playerid] == 1) {
SendClientMessage(playerid, -1, "Unloading Passengers!");
GivePlayerMoney(playerid, 5000);
}
return true;
}
return 1;
#endif
Guys i added this airport for three Planes:
1.Andro
2.Shamal
3.AT-400
Now anyone can tell me how to start /work

that if i type /work there should be checkpoint coming !!
Please Tell me and Get +1 Rep !!
Thanks.
Re: Checkpoint adding ! REP +1 !! -
Avi57 - 31.03.2012
Bump !! Guys Please i need it ASAP.
Re: Checkpoint adding ! REP +1 !! -
Shabi RoxX - 31.03.2012
Here you have I explained all line by line in comments....
pawn Код:
new PlayerChecPoint[MAX_PLAYERS];//this will help us , you will see below
if (strcmp("/work", cmdtext, true, 10) == 0)
{
PlayerChecPoint[playerid] = 1;//this will help us OnPlayerEnterChecpoint , you will see
SetPlayerCheckpoint(playerid,595.3140,875.2714,-43.3098,5.0);
//parameters are (idofplayer,PositionX,positionY,positionZ,sazeof checkponit);
return 1;
}
if (strcmp("/work1", cmdtext, true, 10) == 0)
{
PlayerChecPoint[playerid] = 2;//this will help us OnPlayerEnterChecpoint , you will see
SetPlayerCheckpoint(playerid,594.3141,875.2714,-43.3098,5.0);
//parameters are (idofplayer,PositionX,positionY,positionZ,sazeof checkponit);
return 1;
}
return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
//PlayerCheckpoint[playerid] helps as there is no checkpoint id to specify in which checkpoint player enters
if(PlayerCheckpoint[playerid] == 1)
{//so this helps us which checkpoint it is
SendClientMessage(playerid,-1,"This is Checkpoint number one.");
//so I think you should want here to disablethischecpoint
DisablePlayerCheckpoint(playerid);//disable current checkpoint
//other codes here
}
if(PlayerCheckpoint[playerid] == 2)
{//so this helps us which checkpoint it is
SendClientMessage(playerid,-1,"This is Checkpoint number two.");
//so I think you should want here to disablethischecpoint
DisablePlayerCheckpoint(playerid);//disable current checkpoint
//other codes here
}
return 1;
}
Respuesta: Checkpoint adding ! REP +1 !! -
Chris1337 - 31.03.2012
Better make it on ZCMD
Re: Checkpoint adding ! REP +1 !! -
captainjohn - 31.03.2012
ZCMD.
Put this at the top of your script under #include a_samp
Make sure you download ZCMD here
https://sampforum.blast.hk/showthread.php?tid=91354
pawn Код:
CMD:work(playerid, params[])
{
PlayerChecPoint[playerid] = 1;//this will help us OnPlayerEnterChecpoint , you will see
SetPlayerCheckpoint(playerid,595.3140,875.2714,-43.3098,5.0);
//parameters are (idofplayer,PositionX,positionY,positionZ,sazeof checkponit);
return 1;
}
CMD:work1(playerid, params[])
{
PlayerChecPoint[playerid] = 2;//this will help us OnPlayerEnterChecpoint , you will see
SetPlayerCheckpoint(playerid,594.3141,875.2714,-43.3098,5.0);
//parameters are (idofplayer,PositionX,positionY,positionZ,sazeof checkponit);
return 1;
}
Re: Checkpoint adding ! REP +1 !! -
Avi57 - 31.03.2012
Guys what is this: /work1

?
Re: Checkpoint adding ! REP +1 !! -
Avi57 - 31.03.2012
hey i complied and when i type /work in game it says = Unknown command
Re: Checkpoint adding ! REP +1 !! -
captainjohn - 31.03.2012
Work and work1 are both different commands.
Anyway if you used the STRCMP command, post what you used here, so I can see.
Re: Checkpoint adding ! REP +1 !! -
Harish - 31.03.2012
Hai..,
Try this
Place your script as it is..
You used this code to set checkpoint before that use global variable Float

lchkX,plchkY,plchkZ; i.e
pawn Код:
new Float:plchkX;
new Float:plchkY;
new Float:plchkZ;
///after that use this after your command you placed
SetPlayerCheckpoint(playerid, floatstr(Airports[RandomAirport][1]), floatstr(Airports[RandomAirport][2]), floatstr(Airports[RandomAirport][3]));
plchkX = Airports[RandomAirport][1];
plchkY = Airports[RandomAirport][2];
plchkZ = Airports[RandomAirport][3];
///this will store randomed check points to variable and use this onPlayerEnterCheckPoint(playerid){}
if(IsPlayerInRangeOfPoint(playerid,10,plchkX,plchkY,plchkZ)){///and your codes here after enter checkpoint}
so with this script you can place checkpoints and get it will global variable..try this
Re: Checkpoint adding ! REP +1 !! -
Avi57 - 31.03.2012
Can ANyone make 1 for me ?? i need that when Player type /work without entering vehicle it should say:
"You Need to be in A Vehicle."
and when player sit in plane and type /work so there should be checkpoint appear and when player go to the checkpoint something should appear like this:
"Passengers Loaded!"
and when player fly and reach another checkpoint, he should get some money and something should appear like this:
"Passengers Unloaded!"
and for each type of mission there should be differnet vehicles Like this :
Код:
ublic OnPlayerEnterVehicle(playerid, vehicleid) {
switch(GetVehicleModel(vehicleid)) {
case 519, 577, 592: {
iT MEANS THAT player should have this Id Vehicle for these checkpoints !!