30.11.2014, 14:37
My code
all work fine except the IsADrivingtestVeh it doen't show the message or anything but rentablecar it showing
code .
PHP код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
if(IsPlayerInAnyVehicle(playerid) && !IsBicycle(GetPlayerVehicleID(playerid)))
{
PlayerTextDrawShow(playerid, PlayerText:TextdrawSpeedo[playerid]);
PlayerTextDrawShow(playerid, PlayerText:TextdrawCarhpt[playerid]);
PlayerTextDrawShow(playerid, PlayerText:TextdrawFuelt[playerid]);
PlayerTextDrawShow(playerid, PlayerText:TextdrawLockt[playerid]);
PlayerTextDrawShow(playerid, PlayerText:TextdrawLightt[playerid]);
PlayerTextDrawShow(playerid, PlayerText:TextdrawEnginet[playerid]);
PlayerTextDrawShow(playerid, PlayerText:TextdrawCarnamet[playerid]);
TextDrawShowForPlayer(playerid, TextdrawFuel);
TextDrawShowForPlayer(playerid, TextdrawEngine);
TextDrawShowForPlayer(playerid, TextdrawLock);
TextDrawShowForPlayer(playerid, TextdrawLight);
TextDrawShowForPlayer(playerid, TextdrawCarhp);
TextDrawShowForPlayer(playerid, TextdrawCarname);
new vehicleid = GetPlayerVehicleID(playerid);
if(VehicleSecurity[vehicleid] == 1)
{
ToggleAlarm(vehicleid, VEHICLE_PARAMS_ON);
SetTimerEx("StopAlarm", ALARM_TIME, false, "d", vehicleid);
}
}
else
{
PlayerTextDrawHide(playerid, TextdrawSpeedo[playerid]);
PlayerTextDrawHide(playerid, TextdrawCarhpt[playerid]);
PlayerTextDrawHide(playerid, TextdrawFuelt[playerid]);
PlayerTextDrawHide(playerid, TextdrawLockt[playerid]);
PlayerTextDrawHide(playerid, TextdrawLightt[playerid]);
PlayerTextDrawHide(playerid, TextdrawEnginet[playerid]);
PlayerTextDrawHide(playerid, TextdrawCarnamet[playerid]);
TextDrawHideForPlayer(playerid, TextdrawFuel);
TextDrawHideForPlayer(playerid, TextdrawEngine);
TextDrawHideForPlayer(playerid, TextdrawLock);
TextDrawHideForPlayer(playerid, TextdrawLight);
TextDrawHideForPlayer(playerid, TextdrawCarhp);
TextDrawHideForPlayer(playerid, TextdrawCarname);
}
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
new id = GetVehicleID(vehicleid);
if(IsValidVehicle(id))
{
if(VehicleCreated[id] == VEHICLE_DEALERSHIP)
{
SetPVarInt(playerid, "DialogValue1", id);
ShowDialog(playerid, DIALOG_VEHICLE_BUY);
return 1;
}
}
if(IsARentableVeh(vehicleid))
{
new string[128];
if(!strcmp(Rentcarowner[vehicleid], playername, true)) // Change this too, its only here for testing porpuses.
{
format(string, sizeof(string), "~w~This Is Your Car");
GameTextForPlayer(playerid, string, 5000, 3);
}
else
{
format(string, sizeof(string), "~w~You can Rent this bike~n~Cost:~g~$%d~n~~w~To rent type ~g~/Rentveh~w~~n~to get out type ~r~/exit", Rentmotoprice);
GameTextForPlayer(playerid, string, 5000, 3);
ToggleEngine(vehicleid, VEHICLE_PARAMS_OFF);
}
}
if(IsADrivingtestVeh(vehicleid))
{
new string[128];
if(!strcmp(Drcartester[vehicleid], "None", true)) // Change this too, its only here for testing porpuses.
{
Drcartester[vehicleid] = PlayerName(playerid);
format(string, sizeof(string), "~w~Taking a ~b~Driving Test~n~~w~Vehicle id = %i~n~~y~Press 2 To Start Vehicle", vehicleid);
GameTextForPlayer(playerid, string, 5000, 3);
return 1;
}
if(!strcmp(Drcartester[vehicleid], PlayerName(playerid), true)) // Change this too, its only here for testing porpuses.
{
format(string, sizeof(string), "~w~Continue To Take Your Test");
GameTextForPlayer(playerid, string, 5000, 3);
SCM(playerid,0xFFFF00C8,"[Car Control]"COL_WHITE" ЎґаЕў 2 аѕЧиНКµГҷö¹µм");
SCM(playerid,0xFFFF00C8,"[Car Control]"COL_WHITE" аЕў [4]/[6]/[8] а»ФґЎТГ¤Зє¤ШБГ¶ ¤іРНВЩиє№Г¶Ўґ Ctrl аѕЧиНЕзН¤ №НЎГ¶Ўґ H аѕЧиНЕкН¤");
return 1;
}
if(strcmp(Drcartester[vehicleid], PlayerName(playerid), true)) // Change this too, its only here for testing porpuses.
{
format(string, sizeof(string), "~w~Someone Is Testing This Car");
GameTextForPlayer(playerid, string, 5000, 3);
RemovePlayerFromVehicle(playerid);
return 1;
}
}
if(IsBicycle(vehicleid))
{
ToggleEngine(vehicleid, VEHICLE_PARAMS_ON);
}
if(Fuel[vehicleid] <= 0 && !IsBicycle(vehicleid))
{
ToggleEngine(vehicleid, VEHICLE_PARAMS_OFF);
}
SCM(playerid,0xFFFF00C8,"[Car Control]"COL_WHITE" ЎґаЕў 2 аѕЧиНКµГҷö¹µм");
SCM(playerid,0xFFFF00C8,"[Car Control]"COL_WHITE" аЕў [4]/[6]/[8] а»ФґЎТГ¤Зє¤ШБГ¶ ¤іРНВЩиє№Г¶Ўґ Ctrl аѕЧиНЕзН¤ №НЎГ¶Ўґ H аѕЧиНЕкН¤");
}
return 1;
}
code .
PHP код:
stock IsARentableVeh(carid)
{
for(new i = 1; i <= sizeof(Rentveh); i++)
{
if(carid == Rentveh[i]) return 1;
}
return 0;
}
stock IsADrivingtestVeh(carid)
{
for(new s = 1; s <= sizeof(Drveh); s++)
{
if(carid == Drveh[s]) return 1;
}
return 0;
}