OnPlayerPickUpPickup crash
#1

Hello.

I have 4 pickups that you can only pickup in a vehicle, and when you do, your vehicle gets repaired.
I also have a mine cmd (to plant mines) that is in principle the same, but it creates a explosion when you pickup the pickup, 1 for on foot and 1 for vehicles.

Now when i start the server all pickups works just as they should do, but after like 15-30 minutes it crash to never work again (even if no one has picked up any of the pickups) until i restart with "gmx" or close the server and start it again in windows. The pickups is always there all the time..but they just don't do their work.

Is that a samp bug or a code related bug?
Reply
#2

Anyone? must have it to work :O
Reply
#3

Can you show us the OnPlayerPickUpPickup function, if you don't mind.
Reply
#4

https://sampwiki.blast.hk/wiki/Debugging
Reply
#5

Quote:
Originally Posted by Kostas'
Посмотреть сообщение
Can you show us the OnPlayerPickUpPickup function, if you don't mind.
Here it is.

CODE:
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == newplayer)
    {
        if(GetPlayerTeam(playerid) == 0)
        {
            RepairVehicle(GetPlayerVehicleID(playerid));
            SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
            return 1;}
        }
    else if(pickupid == airwolves)
    {
        if(GetPlayerTeam(playerid) == 1)
        {
            RepairVehicle(GetPlayerVehicleID(playerid));
            SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
            return 1;}
        }
    else if(pickupid == bluefoxes)
    {
        if(GetPlayerTeam(playerid) == 2)
        {
            RepairVehicle(GetPlayerVehicleID(playerid));
            SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
            return 1;}
        }
    else if(pickupid == thunderbirds)
    {
        if(GetPlayerTeam(playerid) == 3)
        {
            RepairVehicle(GetPlayerVehicleID(playerid));
            SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
            return 1;}
        }
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) {continue;}
        if(status[i] == 0) {continue;}
        if(pickupid == minePickup[i])
        {
            new Float:X, Float:Y, Float:Z;
            GetObjectPos(mine[i][0], X, Y, Z);
            CreateExplosion(X, Y, Z, 4, 1);
            CreateExplosion(X, Y, Z, 12, 1);
            DestroyPickup(minePickup[i]);
            DestroyObject(mine[i][0]);
            DestroyObject(mine[i][1]);
            status[i] = 0;
            GameTextForPlayer(playerid,"~r~You have stepped on a mine!",6000,1);
        }
    }
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) {continue;}
        if(vstatus[i] == 0) {continue;}
        if(pickupid == vminePickup[i])
        {
            new Float:X, Float:Y, Float:Z;
            GetObjectPos(vmine[i][0], X, Y, Z);
            CreateExplosion(X, Y, Z, 7, 1);
            DestroyPickup(vminePickup[i]);
            DestroyObject(vmine[i][0]);
            vstatus[i] = 0;
            GameTextForPlayer(playerid,"~r~You have driven over a mine!",6000,1);
        }
    }
    return 1;
}
Reply
#6

Why do you use it like this
pawn Код:
if(!IsPlayerConnected(i)) {continue;}
instead of
pawn Код:
if(!isPlayerConnected(i)) continue;
Reply
#7

Quote:
Originally Posted by Kostas'
Посмотреть сообщение
Why do you use it like this
pawn Код:
if(!IsPlayerConnected(i)) {continue;}
instead of
pawn Код:
if(!isPlayerConnected(i)) continue;
Thats a good question, but that i guess will not solve the problem in the whole OnPlayerPickUpPickup funktion, because the whole OnPlayerPickUpPickup stops working. Or can that have a cause of it?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)