06.10.2016, 05:34
Hey guys. I'm working on three different types of jobs. And I want to active them all by pressing Y. However when I press Y in the server, in the correct vehicle nothing happens...
All the code was working perfectly under commands. However now when I add the fact that the player has to press a key it doesn't work. Any ideas?
All the code was working perfectly under commands. However now when I add the fact that the player has to press a key it doesn't work. Any ideas?
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_YES))
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 482)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new rand = random(sizeof(DeliveryCP));
if(InJob[playerid] == true) return SendClientMessage(playerid, 0xFF0000FF, "You're currently in a mission. Please finish it to start another delivery.");
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 482)
{
InJob[playerid] = true;
DeliveryMan[playerid] = true;
SetPlayerCheckpoint(playerid, DeliveryCP[rand][0], DeliveryCP[rand][1], DeliveryCP[rand][2], 1.5);
GameTextForPlayer(playerid, "~w~COURIER JOB STARTED. DELIVER PACKAGE TO ~n~~r~RED ~w~CHECKPOINT", 5000, 3);
SendClientMessage(playerid, 0x76EEC6FF, "* You can stop the delivery mission by typing /stopwork");
}
}
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 407)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
FiremanJob[playerid] = 1;
GameTextForPlayer(playerid, "~w~FIRE FIGHTER JOB STARTED. DRIVE TO THE ~n~~r~RED ~w~CHECKPOINT", 5000, 3);
SendClientMessage(playerid, 0x76EEC6FF, "* You can stop the delivery mission by typing /stopwork");
SetPlayerCheckpoint(playerid,1099.0345,-1194.4751,18.1079,4);
GivePlayerWeapon(playerid, 42, 99999);
}
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 420 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 438)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new formatted[128];
OnDuty[playerid] = 1;
CreatePlayerDraws(playerid);
SendClientMessage(playerid,COLOR_WHITE,"You are now on duty!");
SendClientFormattedMessageToAll(COLOR_GREEN, "ATTENTION: %s is now a Taxi Driver!", GetName(playerid), "");
format(formatted,128,"Start fare: %.2f$",STARTAMOUNT);
TextDrawSetString(startfare[playerid],formatted);
TextDrawSetString(taxistatus[playerid],"Taxi Status: Free");
new format100[128];
format(format100,128,"100 Meter price: %.2f$",MONEYPER100);
TextDrawSetString(taxi100mfare[playerid],format100);
}
}
}
return 1;
}