SA-MP Forums Archive
vehicletheft not working - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: vehicletheft not working (/showthread.php?tid=557208)



vehicletheft not working - Markus1337 - 13.01.2015

http://pastebin.com/hpmmnPMq

I can't see the problem but it's obviously in there, it always give a normal vehicle theft even though I use a police vehicle.

So I get 2 types of vehicle thefts if i re-enter etc and then the timers run as they should b4 you can get wanted again from stealing the same car.

Bit tired, thanks in advance.


Re: vehicletheft not working - CalvinC - 13.01.2015

You mean this doesn't get activated?
pawn Код:
CommitCrime(playerid, 6, "LEO Vehicle Theft");
StoleCopCarRecently = true;
SetTimer("SCCR", 1000 * 60, false);
I don't really understand what you mean.


Re: vehicletheft not working - Markus1337 - 13.01.2015

No it doesnt recognize the vehicleids properly, a civilian vehicle would give me a Vehicle theft and upon re-entering I will get a LEO vehicle theft even though the IDs aren't matching.

I'm thinking I did something wrong with the IDs but can't really spot it.
The IDs are correct but the way they're written might be what's causing it, idk.


Re: vehicletheft not working - CalvinC - 13.01.2015

Use a switch instead, uses less resources and should work better.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        switch(GetVehicleModel(vehicleid))
        }
        case 416, 497, 427, 490, 596, 597, 598, 599, 253:
        {
                {
                        if(StoleCopCarRecently == false)
                        {
                        if(gTeam[playerid] != POLICE || MEDIC || FBI)
                        {
                                CommitCrime(playerid, 6, "LEO Vehicle Theft");
                                        StoleCopCarRecently = true;
                                        SetTimer("SCCR", 1000 * 60, false);
                        }
                }
        default:
        {
                if(StoleCarRecently == false)
                {
                if(gTeam[playerid] != POLICE || MEDIC || FBI)
                {
                        CommitCrime(playerid, 1, "Vehicle Theft");
                                StoleCarRecently = true;
                                SetTimer("SCR", 1000 * 60, false);
                }
                }
                                }
                        }
                        {
                }
            }
        }
        return 1;
}
This is only an example, im a bit confused by your indentation, so the brackets might not match.


Re: vehicletheft not working - Markus1337 - 13.01.2015

NVM its working, ty.