Not detecting copcar
#1

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
Reply
#2

Any help please i cant do anything till this exists,

EDIT: Sorry for double post deepest applogogies
Reply
#3

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


if (IsACopCar(vehicleid) == 1) ?
Reply
#4

if (IsACopCar(vehicleid))

I shouldnt need the == 1) it should auto detect
Reply
#5

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

Not working...
Reply
#7

597 is an SFPD cop car

Show me your command that tells you that its "not working"
Reply
#8

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;
}
Reply
#9

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
Reply
#10

Works, Sorry im a beginner to scripting
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)