[HELP]OnVehicleStreamin not working properly
#1

Ok when someone enters a vehicle that has alarm and that he doesn't own it is supposed to show a marker above the vehicle but it is not working.heres the code
Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
if(CarAlarm[vehicleid][caalarm] >= 4) {
if(VehAsk[forplayerid] == 2) {
SetVehicleParamsForPlayer(vehicleid, forplayerid,1, 0);
}
}
return 1;
}
Reply
#2

Sorry for a really early bump but i really need this please help me thanks.
Reply
#3

so what your saying is the marker doesnt appear?
Reply
#4

Yes how can i make it appear?
Reply
#5

onvehiclespawn or onplayerupdate

pawn Код:
for(new i; i<MAX_PLAYERS; i++)
    {
        SetVehicleParamsForPlayer(VEHICLEIDHERE, i, 1, 0);
    }
Reply
#6

The markers don't work, or are bugged with the way vehicles are streamed in 0.3 (or so I was informed)

Just use 3DText maybe.
Reply
#7

Quote:
Originally Posted by Rac3r
View Post
The markers don't work, or are bugged with the way vehicles are streamed in 0.3 (or so I was informed)

Just use 3DText maybe.
I added it in my code, works perfectly
Reply
#8

Quote:
Originally Posted by [FU]Victious
Посмотреть сообщение
onvehiclespawn or onplayerupdate

pawn Код:
for(new i; i<MAX_PLAYERS; i++)
    {
        SetVehicleParamsForPlayer(VEHICLEIDHERE, i, 1, 0);
    }
Ok i did this and it didnt work
heres the code this is in OnPlayerStateChange
Код:
     if(CarAlarm[vehi][caalarm] >= 4 && VehAsk[playerid] == 2) {
                 for(new i; i<MAX_PLAYERS; i++)
                 {
                  SetVehicleParamsForPlayer(vehi, i, 1, 0);
                   
                    new name[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, name, sizeof(name));
                    new st[256];
              		//new Float:VPosX,Float:VPosY,Float:VPosZ;
				    //GetVehiclePos(key1[playerid],VPosX,VPosY,VPosZ);
                    format(string, sizeof(string), "*[Vehicle alarm]:BEEP! BEEP! BEEP! BEEP!");
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    format(string,sizeof(string),"SMS:Vehicle %s alarm is activated,Sender: MOLE (555)",VehicleNames[GetVehicleModel(vehi)-400]);
                    SendClientMessage(playerid, 0xE7D5ADFF, string);
      		        SetVehicleParamsForPlayerEx(vehi,playerid,1,1);
					//iVehicleObjective[vehi][0] = 1; //Marker
					//iVehicleObjective[vehi][1] = 0; //Door Lock
                    //CarLabel5 = Create3DTextLabel("Vehicle Alarm is on!" ,COLOR_YELLOW,VPosX,VPosY,VPosY+3,15.0,0);
                    //Attach3DTextLabelToVehicle(CarLabel5,key1[playerid],0.0, 0.0, 0.0);
                    format(st, sizeof(st), "HQ: Crime:Vehicle Alarm has been activated, Suspect Robbing: %s",name);
                    SendFamilyMessage(1, COLOR_DBLUE, st);
                    SetPVarInt(playerid, "VehON", 0);
                    AlarmTime[playerid] = SetTimerEx("Alarm", FLASH_TIME, 1, "i", playerid);
                    Stop[playerid] = SetTimerEx("Chill",SHUTDOWN,false,"i",playerid);
                    return 1;
					
					}

                }
Reply
#9

Anyone please help me fix this asap i really need thanks and sorry for early bump
Reply
#10

Quote:
Originally Posted by Lilcuete
Посмотреть сообщение
Anyone please help me fix this asap i really need thanks and sorry for early bump
pawn Код:
/Top
new myMarkedCar;
 
public OnGameModeInit() //Or another callback
{
myMarkedCar = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 0,0, -1); //For example: Black Landstalker near Blueberry Acres
return 1;
}
 
//Whatever your want
public OnVehicleStreamIn(vehicleid, forplayerid)
{
if(vehicleid == myMarkedCar)
{
SetVehicleParamsForPlayer(TmyMarkedCar, forplayerid, 1, 0); // marker can be visible only if the vehicle streamed for player
}
return 1;
}
Thats straight fromt he wiki

https://sampwiki.blast.hk/wiki/SetVehicleParamsForPlayer

Needs some tweaking, but it should help you
Reply
#11

Quote:
Originally Posted by playbox12
Посмотреть сообщение
pawn Код:
/Top
new myMarkedCar;
 
public OnGameModeInit() //Or another callback
{
myMarkedCar = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 0,0, -1); //For example: Black Landstalker near Blueberry Acres
return 1;
}
 
//Whatever your want
public OnVehicleStreamIn(vehicleid, forplayerid)
{
if(vehicleid == myMarkedCar)
{
SetVehicleParamsForPlayer(TmyMarkedCar, forplayerid, 1, 0); // marker can be visible only if the vehicle streamed for player
}
return 1;
}
Thats straight fromt he wiki

https://sampwiki.blast.hk/wiki/SetVehicleParamsForPlayer

Needs some tweaking, but it should help you
How can i make it for only owned vehicles all of them and if it has alarm?
like dis?
pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
VehAsk[playerid] == 2//sees if he doesnt own the car
CarAlarm[vehi][caalarm]//sees if the vehicle has alarm
if(CarAlarm[vehi][caalarm] >= 4 && VehAsk[playerid] == 2) {

if(GetPlayerVehicleID(forplayer))
{
SetVehicleParamsForPlayer(vehicleid, forplayerid, 1, 0); // marker can be visible only if the vehicle streamed for player
}
Reply
#12

pawn Code:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
VehAsk[playerid] == 2//sees if he doesnt own the car
CarAlarm[vehicleid][caalarm]//sees if the vehicle has alarm
if(CarAlarm[vehicleid][caalarm] >= 4 && VehAsk[playerid] == 2) {

if(GetPlayerVehicleID(forplayer))
{
SetVehicleParamsForPlayer(vehicleid, forplayerid, 1, 0); // marker can be visible only if the vehicle streamed for player
}
Not sure, I am half awake
Reply
#13

Quote:
Originally Posted by playbox12
View Post
pawn Code:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
VehAsk[playerid] == 2//sees if he doesnt own the car
CarAlarm[vehicleid][caalarm]//sees if the vehicle has alarm
if(CarAlarm[vehicleid][caalarm] >= 4 && VehAsk[playerid] == 2) {

if(GetPlayerVehicleID(forplayer))
{
SetVehicleParamsForPlayer(vehicleid, forplayerid, 1, 0); // marker can be visible only if the vehicle streamed for player
}
Not sure, I am half awake
Nah it didnt work heres my code
pawn Code:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
if(CarAlarm[vehicleid][caalarm] >= 4 && VehAsk[forplayerid] == 2) {

if(GetPlayerVehicleID(forplayerid))
{
SetVehicleParamsForPlayer(vehicleid, forplayerid, 1, 0); // marker can be visible only if the vehicle streamed for player
}
}
}
Reply
#14

pawn Code:
if(GetPlayerVehicleID(forplayerid))
what are you trying to do with that?

just do

pawn Code:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(CarAlarm[vehicleid][caalarm] >= 4 && VehAsk[forplayerid] == 2)
   {
        SetVehicleParamsForPlayer(vehicleid, forplayerid, 1, 0);
       }
}
return 1;
}
Reply
#15

Ok that works but if your far away from your vehicle that has the marker in it it disspears and won't show again till you enter the vehicle how can i make it show still if ur far away from the vehicle and not make the marker dissapear?
heres the code
pawn Code:
new vehi = GetPlayerVehicleID(playerid);
for(new i = 0; i < GetMaxPlayers(); i++ )
{
SetVehicleParamsForPlayer(vehi, i, 1, 0);
SetVehicleParamsForPlayer(vehi, playerid, 1, 0);
}
pawn Code:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(CarAlarm[vehicleid][caalarm] >= 4 && VehAsk[forplayerid] == 2)
    {
        SetVehicleParamsForPlayer(vehicleid, forplayerid, 1, 0);
    }
    return 1;
}
Reply
#16

Well, I believe vehicles are not synched unless someone is in it (thats what some people told me) so I don't think thats possible, although it's strange that it doesen't comeback as it should load when OnVehicleStreamIn is called, are you sure that it won't show again if you drive far off and come back?
Reply
#17

Nvm i fixed it thanks please close this topic,thanks for helping all.
Reply
#18

Cool, can you tell us what fixed it?
Reply
#19

OnVehicleStreamin did.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)