Message When trying to enter locked vehicle
#1

Title explains everything,

I have this

pawn Код:
if(!strcmp(cmdtext,"/lock",true))
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFFFFFAA,"You have to be inside a vehicle.");
        for(new i=0; i < MAX_PLAYERS; i++)
        {
            //if(i == playerid) continue;
            SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,1);
        }
        return 1;
    }
and I tried it with

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(doors == 1)
    {
        new Text:txt;
        txt = TextDrawCreate(10.0, 250.0, "This Vehicle is Locked");
        TextDrawUseBox(txt, 1);
        TextDrawBoxColor(txt, 0x00000055);
        TextDrawTextSize(txt, 125, 5);
        TextDrawShowForPlayer(playerid, txt);
    }
    return 1;
}
but it's not working since it's "OnEnterVehicle", unfortunatelly vehicle is locked so player can't enter it, so I need something when he tries to enter vehicle + is there any way to play that animation like player is trying to open doors but they are locked when doors are locked? I mean like when in singleplayer you try to get police car..
Reply
#2

put it OnPlayerStateChange

put this OnPlayerStateChange

pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
      //put the code here
}
Reply
#3

Quote:
Originally Posted by Romel
Посмотреть сообщение
put it OnPlayerStateChange

put this OnPlayerStateChange

pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
      //put the code here
}
did you read what I wrote?
Reply
#4

pawn Код:
if(!strcmp(cmdtext,"/lock",true))
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFFFFFAA,"You have to be inside a vehicle.");
        for(new i=0; i < MAX_PLAYERS; i++)
        {
            //if(i == playerid) continue;
            SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,1);
            SendClientMessage(playerid, -1, "Vehicle Lock!");
        }
        return 1;
    }
   
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(doors == 1)
    {
        SendClientMessage(playerid, -1, "This Vehicle is Locked");
    }
    return 1;
}
hmm
Reply
#5

Quote:
Originally Posted by Devilxz97
Посмотреть сообщение
pawn Код:
if(!strcmp(cmdtext,"/lock",true))
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFFFFFAA,"You have to be inside a vehicle.");
        for(new i=0; i < MAX_PLAYERS; i++)
        {
            //if(i == playerid) continue;
            SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,1);
            SendClientMessage(playerid, -1, "Vehicle Lock!");
        }
        return 1;
    }
   
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(doors == 1)
    {
        SendClientMessage(playerid, -1, "This Vehicle is Locked");
    }
    return 1;
}
hmm
please start reading topics

Quote:

but it's not working since it's "OnEnterVehicle", unfortunatelly vehicle is locked so player can't enter it, so I need something when he tries to enter vehicle

Reply
#6

create an other callback's then ..
Reply
#7

Try locking it with this https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
--------------------------------------------
If it dont work you must rewrite some thing:
You must remember the vehicleid is locked.
Shen u set paramsforplayer in
Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}
And
Reply
#8

Quote:
Originally Posted by TheDeath
Посмотреть сообщение
Try locking it with this https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
--------------------------------------------
If it dont work you must rewrite some thing:
You must remember the vehicleid is locked.
Shen u set paramsforplayer in
Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}
And
oh god, there's not a single person that can read topic properly or what?
Reply
#9

bump, someone who can read topic and can help me instead of posting bunch of useless links that I already mentioned and don't works?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)