SA-MP Forums Archive
Not detecting copcar - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Not detecting copcar (/showthread.php?tid=81640)



Not detecting copcar - JoeDaDude - 12.06.2009

pawn Код:
public IsACopCar(carid)
{
    new vehicle = GetVehicleModel(carid);
    if(vehicle == 597)
    {
        return 1;
    }
    return 0;
}
I go on my server, Type /v 597 0 1,
I get in try cuff and it says im not in a registered car,
So i goto SFPD using /gotosf, And try get in that car,
And again try cuff, It still says im not in copcar,
Is that looking for like... new 597?
If it is how to make it search for the vehicle id 597



Re: Not detecting copcar - JoeDaDude - 12.06.2009

Any help please i cant do anything till this exists,

EDIT: Sorry for double post deepest applogogies


Re: Not detecting copcar - efeX - 12.06.2009

are you using it like
if (IsACopCar(vehicleid)) or


if (IsACopCar(vehicleid) == 1) ?


Re: Not detecting copcar - JoeDaDude - 12.06.2009

if (IsACopCar(vehicleid))

I shouldnt need the == 1) it should auto detect


Re: Not detecting copcar - BMUK - 12.06.2009

pawn Код:
public IsACopCar(carid) {
if(GetVehicleModel(carid) == 597) return 1;
return 0;
}



Re: Not detecting copcar - JoeDaDude - 12.06.2009

Not working...


Re: Not detecting copcar - BMUK - 12.06.2009

597 is an SFPD cop car

Show me your command that tells you that its "not working"



Re: Not detecting copcar - JoeDaDude - 12.06.2009

pawn Код:
if (strcmp(cmd, "/cuff", true) == 0)
{
new tmp[20];
tmp = strtok(cmdtext, index);
if (strlen(tmp))
{
id = strval(tmp);
if (IsPlayerConnected(id))
{
if (IsACopCar(carid))
{
SendClientMessage(id, 0xFFFFFFFFF, "You have been cuffed and cannot move");
TogglePlayerControllable(id,0);
return 1;
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You're not in a registered cop car");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Player is not found");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "[Usage]: /cuff [playerid/name]");
}
return 1;
}



Re: Not detecting copcar - BMUK - 12.06.2009

lul.. does that even compile?

I can assure you that if you use it correctly then the code I posted does work.

Use: if(IsACopCar(GetPlayerVehicleID(playerid)))

You just had (carid)

You might also want to include a check to see if they are even in a vehicle


Re: Not detecting copcar - JoeDaDude - 12.06.2009

Works, Sorry im a beginner to scripting