Little help please.
#1

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
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;
}
Reply
#2

Make an array and create the pickups..then loop through pickups when player enter one..
for example
pawn Код:
new Pickup[2];

//OnGameModeInit

Pickup[0] = Createpickup..
Pickup[1] = Createpickup..

//OnPlayerPickupPickUp

for(new i; i<sizeof(Pickup); i++)
{
    if(pickupid == Pickup[0])
    {
    //Open the gate
    }
}
Reply
#3

It is working now but when i open the gate with second pickup that i just created, it sends the register message (that sends to player when they are registering) also all my stats got resetted automatically. lol it happened when i added for(new i; i<sizeof(Pickup); i++). There's no error but the server looks bugged.
Reply
#4

/bump

Help me to fix this issue please. I did what you told me and my whole GM got bugged idk how, i had to replace it with my old backup.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)