SA-MP Forums Archive
Message When trying to enter locked vehicle - 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: Message When trying to enter locked vehicle (/showthread.php?tid=363633)



Message When trying to enter locked vehicle - SEnergy - 28.07.2012

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..


Re: Message When trying to enter locked vehicle - JaKe Elite - 28.07.2012

put it OnPlayerStateChange

put this OnPlayerStateChange

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



Re: Message When trying to enter locked vehicle - SEnergy - 28.07.2012

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?


Re: Message When trying to enter locked vehicle - Devilxz97 - 28.07.2012

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


Re: Message When trying to enter locked vehicle - SEnergy - 28.07.2012

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




Re: Message When trying to enter locked vehicle - Devilxz97 - 28.07.2012

create an other callback's then ..


Re: Message When trying to enter locked vehicle - TheDeath - 28.07.2012

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


Re: Message When trying to enter locked vehicle - SEnergy - 28.07.2012

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?


Re: Message When trying to enter locked vehicle - SEnergy - 28.07.2012

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?