Pickup
#1

Why dosent the "Star" dissapier when i Pick it up??

Код:
3 Pickupable, respawns after death
pawn Код:
#include <a_samp>
#include <streamer>

new ReduceWantedLevelStar[4];

public OnFilterScriptInit()
{
    ReduceWantedLevelStar[0] = AddStaticPickup(1247, 2, 2163.107910, 2473.048095, 10.820312, 0);
    ReduceWantedLevelStar[1] = AddStaticPickup(1247, 2, 1179.600219, 873.894409, 11.612189, 0);
    ReduceWantedLevelStar[2] = AddStaticPickup(1247, 2, 2161.824218, 2268.165039, 18.843717, 0);
    ReduceWantedLevelStar[3] = AddStaticPickup(1247, 2, 2853.885253, 642.362365, 35.844734, 0);
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(ReduceWantedLevelStar[3])
    {
        new wanted = GetPlayerWantedLevel(playerid);
        if(wanted == 0)
        {
            SendClientMessage(playerid, 0xFF0000FF, "You is not wanted.");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000FF, "Your wanted level has been reduced");
            SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) -1);
            return 1;
        }
    }
    return 0;
}
Reply
#2

Well for one thing, the if statement makes no sense, you are just checking if the variable "ReduceWantedLevelStar[3]" is true, which it will be recognized as in this case.

You need to compare it to something, I assume you want to check if it's the pickup that was picked up, then you should make the if statement compare the variable holding the pickupid with the pickupid passed by the callback, for example:

pawn Код:
if(pickupid == ReduceWantedLevelStar[3])
Reply
#3

Apart from what JaTochNietDan said, that should work to be honest, but you could try destroying the pickup when someone picks it up

pawn Код:
DestroyPickup(ReduceWantedLevelStar[3]); //For example
Reply
#4

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Apart from what JaTochNietDan said, that should work to be honest, but you could try destroying the pickup when someone picks it up

pawn Код:
DestroyPickup(ReduceWantedLevelStar[3]); //For example
Place this under "OnPlayerPickUpPickup"
Reply
#5

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Well for one thing, the if statement makes no sense, you are just checking if the variable "ReduceWantedLevelStar[3]" is true, which it will be recognized as in this case.

You need to compare it to something, I assume you want to check if it's the pickup that was picked up, then you should make the if statement compare the variable holding the pickupid with the pickupid passed by the callback, for example:

pawn Код:
if(pickupid == ReduceWantedLevelStar[3])
Yeah, Thanks, helped alot :P

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Apart from what JaTochNietDan said, that should work to be honest, but you could try destroying the pickup when someone picks it up

pawn Код:
DestroyPickup(ReduceWantedLevelStar[3]); //For example
But doesnt that destroy my pickup till i restart the server?
Reply
#6

Quote:
Originally Posted by Unknown123
Посмотреть сообщение
Yeah, Thanks, helped alot :P



But doesnt that destroy my pickup till i restart the server?
Yes, additionally it only works with pickups created with the CreatePickup function and not the AddStaticPickup function.
Reply
#7

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Yes, additionally it only works with pickups created with the CreatePickup function and not the AddStaticPickup function.
Emm, can you fix the code for me? And i can see what you change?
Because it is hard to me to understand, because i have bad english :P im from Norway :O
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)