Problem with ids - 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: Problem with ids (
/showthread.php?tid=115063)
Problem with ids -
SlashPT - 22.12.2009
so hi today i have a problem with ids so i have this code
pawn Код:
public EnterVec(playerid, vehicleid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new JH [128];
new strh[128];
new player[MAX_PLAYER_NAME];
GetPlayerName(playerid, player, sizeof(player));
{
format(JH, sizeof(JH), "Vehicle Number Registrement: INGSV-0091-[%d]-159", GetPlayerVehicleID(playerid));
SendClientMessage(playerid, COLOR_BLUE, JH);
}
{
SendClientMessage(playerid, COLOR_RED,"[Vehicle]: Please put the Seatbelt or Helmet using /seatbelt or /helmet");
}
{
format(strh, sizeof(strh), "** %s: enters in the vehicle and prepares to start the engine **", player);
ProxDetector(15.0, playerid, strh, COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
}
}
else{return 1;}
return 1;
}
but it is only showed to ID 0 all things to him how i do it for who is entering in the vehicle...
i cant put it on the OnPlayerEnterVehicle bcs dont work the
pawn Код:
format(JH, sizeof(JH), "Vehicle Number Registrement: INGSV-0091-[%d]-159", GetPlayerVehicleID(playerid));
so to it work i needed to put one timer and some time after i enter in the vehicle it showes it all
so if any guy have the solution .... THANKS
Re: Problem with ids -
SlashPT - 22.12.2009
oh i forgot and if i can know the GetPlayerVehicleID(playerid)); in OnPlayerEnterVehicle withou my timer say here bcs idk
Re: Problem with ids -
Babul - 22.12.2009
the callback
https://sampwiki.blast.hk/wiki/OnPlayerEnterVehicle you are using gets the playerid too early.. so i suggest you to use the
https://sampwiki.blast.hk/wiki/OnPlayerStateChange and use it like this:
Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
//...
if(newstate == PLAYER_STATE_DRIVER)
{
new VehID;
VehID=GetVehicleModel(GetPlayerVehicleID(playerid));
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
new string[64];
format(string,sizeof(string), "(%d) %s entered Vehicle ID %d", playerid, Name, VehID);
SendClientMessageToAll(0x55aaffff,string);
//SendClientMessage(playerid,0x55aaffff,string);
}
//...
}
Re: Problem with ids -
SlashPT - 22.12.2009
nope this isnt what i want i want it saying when i press enter of F and its ID not model and i dont want to all but yes to a radius of 15