30.11.2014, 14:33
Here is the OnPlayerStateChange. I cant see any issues...
Код:
public OnPlayerStateChange(playerid, newstate, oldstate) { new vehicleid = GetPlayerVehicleID(playerid); if(newstate == PLAYER_STATE_DRIVER) SetPlayerArmedWeapon(playerid, 0); if(!IsPlayerAdmin(playerid)) { new vid = GetVehicleID(GetPlayerVehicleID(playerid)); if(vInfo[vid][vDealer] == 1) { new str[128]; format(str, sizeof(str), "Price: $%d\nWould you like to buy\nthis car?", vInfo[vid][vPrice]); ShowPlayerDialog(playerid, DIALOG_VBUY, DIALOG_STYLE_MSGBOX, "Buy Vehicle", str, "Buy", "Cancel"); SetPVarInt(playerid, "DealershipVehicle", vInfo[vid][vModel]); } } if(newstate == 2) { if(IsLAPDVeh(GetPlayerVehicleID(playerid)) && pInfo[playerid][pFaction] != 1) { RemovePlayerFromVehicle(playerid); } } if(newstate == PLAYER_STATE_PASSENGER) // TAXI & BUSSES { new string[128]; new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 2 && TransportDuty[i] > 0) { if(GetPlayerMoney(playerid) < TransportValue[i]) { format(string, sizeof(string), "* You need $%d to enter.", TransportValue[i]); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); RemovePlayerFromVehicle(playerid); } else { if(TransportDuty[i] == 1) { format(string, sizeof(string), "* You paid $%d to the Taxi Driver.", TransportValue[i]); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "* Passenger %s has entered your Taxi.", name); SendClientMessage(i, COLOR_LIGHTBLUE, string); pInfo[playerid][pCash] -= TransportValue[i]; TransportMoney[i] += TransportValue[i]; TransportTime[i] = 1; TransportTime[playerid] = 1; TransportCost[playerid] = TransportValue[i]; TransportCost[i] = TransportValue[i]; TransportDriver[playerid] = i; KillTimer(TaxiDestTimer[i]); TaxiCall = 999; DisablePlayerCheckpoint(i); } } } } } } return 1; }