02.05.2010, 18:03
Hey,
Today i make a taxi-script. The player that enters the taxi sees a gametext, that shows him the price of his ride. The price becomes higher and higher every ten seconds. If the player exits the taxi, the cost of the taxi ride will be take, and the money have to go to the taxidriver (thats a player to). My problem is its dont work, and i dont see whats wrong. I get no errors or warnings. Here you see my script:
Greetz
Sean5874
Today i make a taxi-script. The player that enters the taxi sees a gametext, that shows him the price of his ride. The price becomes higher and higher every ten seconds. If the player exits the taxi, the cost of the taxi ride will be take, and the money have to go to the taxidriver (thats a player to). My problem is its dont work, and i dont see whats wrong. I get no errors or warnings. Here you see my script:
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { new seat; new veh; veh = GetVehicleModel(vehicleid); seat = GetPlayerVehicleSeat(playerid); if(veh == 420) //taxi id { if(seat > 0) // we dont show the timer if the player is a driver { SetTimer("TaxiCost",10000,true); /the timer SendClientMessage(playerid, COLOR_YELLOW,"You has entered the taxi as a passenger."); taxiride[playerid] = 1; taxicost[playerid] = 0; } } } public OnPlayerExitVehicle(playerid, vehicleid) { KillTimer(taxitimer); if(taxiride[playerid] == 1) { new dvehicle; new pvehicle; new seat; new tstring2[128]; new tstring3[128]; format(tstring2, sizeof(tstring2),"~g~paid: $%d!",taxicost[playerid]); GameTextForPlayer(playerid, tstring2, 4000, 1); format(tstring3, sizeof(tstring3),"You have exited the taxi. You have paid $%d to the taxi driver.",taxicost[playerid]); SendClientMessage(playerid, COLOR_YELLOW, tstring3); taxiride[playerid] = 0; GameTextForPlayer(playerid,"_",10000, 1); GivePlayerMoney(playerid, -taxicost[playerid]); pvehicle = GetPlayerVehicleID(playerid); for(new i=0; i<MAX_PLAYERS; i++) /// look for the taxi drivers id { if(IsPlayerInVehicle(i, 420)) { dvehicle = GetPlayerVehicleID(i); if(dvehicle == pvehicle) { seat = GetPlayerVehicleSeat(i); if(seat == 0) { new dstring[128]; GivePlayerMoney(i, taxicost[playerid]); format(dstring, sizeof(dstring),"Your passenger has exited your taxi, your earnings: $%d",taxicost[playerid]); SendClientMessage(i, COLOR_YELLOW, dstring); taxicost[playerid] = 0; return 1; } } } } } }
Sean5874