Pickups problem
#1

Hello, I got a pickup problem that I haven't had before...
well the problem is that when I enter one pickup it does not do what I want it to do...
look:
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    new string[128];
    if(pickupid == PackagePickup)
        return PackageHuntFound(playerid);
       
    if(pickupid == cannonpickup)
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"You need to be in a car to use the cannon!");
        GameTextForPlayer(playerid,"~r~G~g~e~y~t ~p~R~r~e~g~a~y~d~b~y!", 3000, 4);
        SetTimerEx("cannongatesopen", 3000, false, "i", playerid); //3 seconds
        TogglePlayerControllable(playerid,0);
    }

    return 1;
}
As you can see I made a little hidden package game, and also a cannon thing but when I pickup the cannonpickup I get the messages from the Hidden pacakge hunting... any help?
thanks inadvance
rep for helper
Reply
#2

I didn't get what you mean, You don't get this ?

PHP код:
GameTextForPlayer(playerid,"~r~G~g~e~y~t ~p~R~r~e~g~a~y~d~b~y!"30004); 
Reply
#3

No, when I pickup the pickup I get everything that falls under the pickup from the package hunt
Reply
#4

Its because you haven't return true under

PHP код:
if(pickupid == PackagePickup)
        return 
PackageHuntFound(playerid); 
I believe that's the reason why it keeps repeatin.
Reply
#5

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    new string[128];
    if(pickupid == PackagePickup)
    {
        PackageHuntFound(playerid);
        return 1;
    }
    if(pickupid == cannonpickup)
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"You need to be in a car to use the cannon!");
        GameTextForPlayer(playerid,"~r~G~g~e~y~t ~p~R~r~e~g~a~y~d~b~y!", 3000, 4);
        SetTimerEx("cannongatesopen", 3000, false, "i", playerid); //3 seconds
        TogglePlayerControllable(playerid,0);
    }

    return 1;
}
still the same problem...
more code:
pawn Код:
public PackageHuntFound(playerid)
{
    new name[MAX_PLAYER_NAME], string[128], rand;
    GetPlayerName(playerid, name, sizeof(name));
    rand = random(sizeof(pHunt));
    pIndex = rand;

    KillTimer(PackageHuntRestartTimer);
    DestroyPickup(PackagePickup);

    format(string, sizeof(string), "Hidden Package: Player %s(%i) has found the current package and earned 50000$", name, playerid);
    SendClientMessageToAll(COLOR_WHITE, string);
    format(string, sizeof(string), "Hidden Package: A new package was placed, tip: %s (/packagehunt)" ,pHunt[pIndex][pTip]);
    SendClientMessageToAll(COLOR_WHITE, string);

    PackagePickup = CreatePickup(1276, 23, pHunt[pIndex][pX], pHunt[pIndex][pY], pHunt[pIndex][pZ], -1);
    PackageHuntRestartTimer = SetTimer("PackageHuntRestart", PackageRestart, false); // look at the defines for the exact time...
    GivePlayerMoney(playerid, 50000);
    pData[playerid][pHiddenPackage]++;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)