15.12.2013, 15:44
Hi, i have made this script when player enters a pickup the dialog appears and when they click pay it will open the gate. It is working fine.
So the pickup is in the first side, and i want the same pickup on another side which does the same action as first pickup. Can anyone tell me how do i make the same action to open gate using multiple pickup? I tried creating another pickup and using the same action and it crashed my pawno when i compiled lol D: Need help if possible.
Code
So the pickup is in the first side, and i want the same pickup on another side which does the same action as first pickup. Can anyone tell me how do i make the same action to open gate using multiple pickup? I tried creating another pickup and using the same action and it crashed my pawno when i compiled lol D: Need help if possible.
Code
pawn Код:
new gate;
new pickup_gate;
public OnGameModeInit()
{
pickup_gate = CreatePickup(19133, 2, 842.33661, -2110.07422, 13.49668);
SetTimer("GateCheck", 30000, true);
gate = CreateObject(980, 837.05939, -2115.00830, 15.45802, 0.00000, 0.00000, -180.23990);
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == pickup_gate)
ShowPlayerDialog(playerid, pickup_gate, DIALOG_STYLE_LIST, "Pay your ticket here", "Pay $200 for the gate", "PAY","CANCEL");
return 1;
}
new bool:gateopen;
forward GateCheck();
public GateCheck()
{
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 837.05939, -2115.00830, 15.45802, 10.0))
{
return;
}
}
if(gateopen == true)
{
MoveObject(gate, 837.05939, -2115.00830, 15.45802, 3.5);
gateopen = false;
}
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == pickup_gate)
{
if(response)
{
if(listitem == 0)
{
if(gateopen == false)
{
MoveObject(gate, 837.05939, -2115.00830, 20.72209, 3.5);
SendClientMessage(playerid, 0x1FA340FF, "**You have paid $200 for the gate. {55DF78}The gate will be closed in 30 seconds.");
RewardPlayer(playerid, -200, 0);
gateopen = true;
}
}
}
return 1;
}