Checkpoint ID. Onplayerentercheckpoint. How to do it? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Checkpoint ID. Onplayerentercheckpoint. How to do it? (
/showthread.php?tid=271457)
Checkpoint ID. Onplayerentercheckpoint. How to do it? -
lewismichaelbbc - 24.07.2011
Hello, i have already checked the wiki and could not find any help for my case. I have created a checkpoint:
Top of my script:
pawn Код:
#define itemmilk 1995.1034,-2316.4031,13.5469
OnDialogResponse:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
if(response)
{
if(listitem == 0) // Deliver Milk
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, itemmilk, 10.0);
}
}
}
return 1;
}
In the game it sets the checkpoint on my map. However i am not sure on how to create a command for OnPlayerEnterCheckpoint:
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 593 & 592 & 511 & 553 & 417)
{
if (IsPlayerInRangeOfPoint(playerid, 7.0,loaditem))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Type Of Package","Deliver Passengers\n Deliver Milk\n Deliver Engine Fuel\n Deliver Electronics", "Select", "Cancel");
}
}
return 1;
}
When someone enters the checkpoint ''itemmilk'', i need it to deletetheplayerscheckpoint and send them a message to say that they have arrived.
Could someone show me what code i would use for this.
Thanks
Re: Checkpoint ID. Onplayerentercheckpoint. How to do it? -
MadeMan - 24.07.2011
pawn Код:
stock IsDeliveryVehicle(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 593,592,511,553,417: return 1;
}
return 0;
}
command:
pawn Код:
if(IsDeliveryVehicle(GetPlayerVehicleID(playerid)))
{
if (IsPlayerInRangeOfPoint(playerid, 7.0,loaditem))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Type Of Package","Deliver Passengers\n Deliver Milk\n Deliver Engine Fuel\n Deliver Electronics", "Select", "Cancel");
}
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
if(response)
{
if(listitem == 0) // Deliver Milk
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, itemmilk, 10.0);
SetPVarInt(playerid, "CP", CP_DELIVERMILK);
}
}
}
return 1;
}
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(GetPVarInt(playerid, "CP") == CP_DELIVERMILK)
{
DisablePlayerCheckpoint(playerid);
SetPVarInt(playerid, "CP", 0);
SendClientMessage(playerid, 0xFFFFFFFF, "You have arrived");
return 1;
}
return 1;
}