A little help - 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: A little help (
/showthread.php?tid=351284)
A little help -
christiand - 15.06.2012
Hei ,
I made few days ago a simple /fare command for taxi drivers , like when i type it will appear to all players screen a message : Taxi driver x is on duty , call him on y . First question , i can create something like /gps <id of player> and will set a red checkpoint on map with players location ( after he calls me i will track his possition ) if not i will try to do like this - put a textdraw with player's location on screen and taxi driver will use /gps and will choose from a dialog location to track on gps (it's a good idea too , i think) . 2nd question : i want to make a - + money system for this fare , i want to check if i have passenger in taxi then every 1 min ( with a timer for sure ) i want to take his money with Giveplayermoney , and to add same amount to me the driver ( a constant value , eg : 5 $ ) , but the question is i can check if i have passenger in taxi somehow ?
Re: A little help -
Jonny5 - 15.06.2012
yes you can
you need to use a loop threw the players
then get their vehicleid with
https://sampwiki.blast.hk/wiki/GetPlayerVehicleID
and use
https://sampwiki.blast.hk/wiki/GetPlayerVehicleSeat
to get their seat
0=driver 1,2,3 = passengers
or if you know the driver just checking if the vid == drivers vid would be good enough
Re: A little help -
christiand - 15.06.2012
Ok , please check this , i am really newbie , but i like scripting and want to learn.
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new veh;
veh = GetPlayerVehicleID(i);
iSeat = GetPlayerVehicleSeat(i);
if(GetPlayerMoney(playerid) < 5)
{
RemovePlayerFromVehicle(i);
}
else
{
if(GetVehicleModel(veh) == taxiIDVEH && GetVehicleModel(veh) == taxiIDVEH)
{
if(iSeat == 1 && iSeat == 2 && iSeat == 3) // it's right ?
{
there i want to put a textdraw with a cronometer and at 1:00 2:00 get value of x$ . but i do.t know how to make cronometer and textraw with changeable price :( if can help would be nice . need atleast one start idea.
SetTimer("TaxiFare" ,60000,true); // this calls every 1 min right ?
but for declare this timer what i need to do ?
something like :
GivePlayerMoney(i, -5) - should be for passenger ..
GivePlayerMoney(playerid, 5) - i think for me i need to check if i am on seat 0 or something like that with another FOR , .. i don't understand there :( i am newbie
and some sendclientmessages for sure there .
}
}
}
}
and this FOR i should add in onplayerentervehicle right ?
Re: A little help -
christiand - 16.06.2012
Anyone ? It compile but don.t work . Even if i add a sendclientmessage when i enter as a passenger ... (no message appear on screen ) Any other idea ?