Pickup bug
#1

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(PlayerInfo[playerid][pLvDovana] == 0)
    {
        if(pickupid == dovana) GivePlayerMoney(playerid,1000);
        SendClientMessage(playerid, 0xDEEE20FF, "Sveikiname, prizas: 1000 LT.");
        PlayerInfo[playerid][pLvDovana] = true;
    }
    else
    {
        SendClientMessage(playerid, 0xDEEE20FF, "Jūs jau gavote priza!");
}

       if(PlayerInfo[playerid][pVip] == 1)
    {
        if(pickupid == vipams) GivePlayerWeapon(playerid, 31, 500);
        GivePlayerWeapon(playerid, 25, 500);
        SendClientMessage(playerid, 0xDEEE20FF, "Gavote VIP ginklus.");
    }
    else
    {
    SendClientMessage(playerid, 0xDEEE20FF, "Jūs ne VIP");
    }
    return 1;
}
When player pick up this pickup:
if(pickupid == vipams)

he get two messages:
SendClientMessage(playerid, 0xDEEE20FF, "Jūs jau gavote priza!");

SendClientMessage(playerid, 0xDEEE20FF, "Gavote VIP ginklus.");
Reply
#2

can you show us the code where you create those pickups?
Reply
#3

Problem not in pickups create..

dovana = CreateDynamicPickup(19056, 2, 1326.5134,1365.1432,54);
vipams = CreateDynamicPickup(2969, 2, 2013.8668,2674.0786,11);
Reply
#4

Well try this:
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
 if(PlayerInfo[playerid][pLvDovana] == 0)
 {
  if(pickupid == dovana)
  {  
    GivePlayerMoney(playerid,1000);
    SendClientMessage(playerid, 0xDEEE20FF, "Sveikiname, prizas: 1000 LT.");
    PlayerInfo[playerid][pLvDovana] = true;
  }
 }
 else  
 {
  SendClientMessage(playerid, 0xDEEE20FF, "Jūs jau gavote priza!");
 }
 if(PlayerInfo[playerid][pVip] == 1)
 {
   if(pickupid == vipams)
   {
    GivePlayerWeapon(playerid, 31, 500);
    GivePlayerWeapon(playerid, 25, 500);
    SendClientMessage(playerid, 0xDEEE20FF, "Gavote VIP ginklus.");
    }
 }
 else
 {
    SendClientMessage(playerid, 0xDEEE20FF, "Jūs ne VIP");
 }
 return 1;
}
Reply
#5

I must have this message:
SendClientMessage(playerid, 0xDEEE20FF, "Gavote VIP ginklus.");

but i got this: SendClientMessage(playerid, 0xDEEE20FF, "Jūs jau gavote priza!");

With your code.
Reply
#6

it could be because your PlayerInfo[playerid][pLvDovana] is not 0
Reply
#7

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
it could be because your PlayerInfo[playerid][pLvDovana] is not 0
PlayerInfo[playerid][pLvDovana] = true;
Reply
#8

Any ideas?
Reply
#9

Quote:
Originally Posted by Louris
Посмотреть сообщение
PlayerInfo[playerid][pLvDovana] = true;
Do not post such huge stuff.

and btw THAT IS WHAT I AM SAYING

True = 1
False = 0
in the code it is checking if it is 0 (WHICH IS FALSE), then it executes the code or it sends the message you are getting..

to fix it use this
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
 if(PlayerInfo[playerid][pLvDovana] == true)
 {
  if(pickupid == dovana)
  {  
    GivePlayerMoney(playerid,1000);
    SendClientMessage(playerid, 0xDEEE20FF, "Sveikiname, prizas: 1000 LT.");
    PlayerInfo[playerid][pLvDovana] = true;
  }
 }
 else  
 {
  SendClientMessage(playerid, 0xDEEE20FF, "Jūs jau gavote priza!");
 }
 if(PlayerInfo[playerid][pVip] == 1)
 {
   if(pickupid == vipams)
   {
    GivePlayerWeapon(playerid, 31, 500);
    GivePlayerWeapon(playerid, 25, 500);
    SendClientMessage(playerid, 0xDEEE20FF, "Gavote VIP ginklus.");
    }
 }
 else
 {
    SendClientMessage(playerid, 0xDEEE20FF, "Jūs ne VIP");
 }
 return 1;
}
and PLEASE follow Lord's signature..maybe it can help control your temper

Quote:
Originally Posted by ******
Посмотреть сообщение
There are ways to highlight issues with includes and suggest improvements, and there are ways to just be mean to people. If you don't know the difference - don't reply, you'll just put people off posting who may turn out to be great coders!
Reply
#10

See how you're setting it to true, that means you're setting it to 1, and once it reaches the else statement, it is already set to 1, so it will also send that message. You need to use an else if statement here.

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(PlayerInfo[playerid][pLvDovana] == 0)
    {
        if(pickupid == dovana) GivePlayerMoney(playerid,1000);
        SendClientMessage(playerid, 0xDEEE20FF, "Sveikiname, prizas: 1000 LT.");
        PlayerInfo[playerid][pLvDovana] = true;
    }
    else if(PlayerInfo[playerid][pLvDovana] == true)
    {
        SendClientMessage(playerid, 0xDEEE20FF, "Jūs jau gavote priza!");
}

       if(PlayerInfo[playerid][pVip] == 1)
    {
        if(pickupid == vipams) GivePlayerWeapon(playerid, 31, 500);
        GivePlayerWeapon(playerid, 25, 500);
        SendClientMessage(playerid, 0xDEEE20FF, "Gavote VIP ginklus.");
    }
    else
    {
    SendClientMessage(playerid, 0xDEEE20FF, "Jūs ne VIP");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)