06.02.2013, 01:35
I fixed it just before you posted, but thanks. Here's my new code, as I have another problem. When the player has the correct job, they are able to enter the vehicle, however it still comes up with the message saying they do not have the job. Any help would be appreciated - thanks
Код:
// This is a comment // uncomment the line below if you want to write a filterscript //#define FILTERSCRIPT #include <a_samp> //Cityhall & Jobs new jobpickup; new cityhallenterpickup; new cityhallexitpickup; new job[MAX_PLAYERS]={0}; #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Blank Filterscript by your name here"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } #else main() { print("\n----------------------------------"); print(" Blank Gamemode by your name here"); print("----------------------------------\n"); } #endif public OnGameModeInit() { // Don't use these lines if it's a filterscript SetGameModeText("Rhys' Test"); AddPlayerClass(286,1481.0565,-1771.2000,18.7958,181.4338,0,0,0,0,0,0); // Cityhall & Jobs Pickups jobpickup = CreatePickup(1239,1,363.4658,173.8406,1008.3828); cityhallenterpickup = CreatePickup(1239,1,1481.0565,-1771.2000,18.7958); cityhallexitpickup = CreatePickup(1239,1,387.9753,173.5708,1008.3828); //Job Vehicles CreateVehicle(448,2098.0735,-1793.0139,12.9846,88.1403,3,6,120000); CreateVehicle(448,2098.1221,-1794.8608,12.9778,89.6968,3,6,120000); CreateVehicle(448,2098.0640,-1796.6982,12.9868,89.8181,3,6,120000); CreateVehicle(448,2098.2153,-1799.0900,12.9883,93.7124,3,6,120000); CreateVehicle(448,2098.0923,-1801.3217,12.9855,91.5414,3,6,120000); CreateVehicle(403,1989.9371,-2058.1421,13.9763,89.9044,37,1,120000); CreateVehicle(403,1989.9835,-2062.7520,13.9769,89.7113,37,1,120000); CreateVehicle(514,1974.9984,-2064.7517,13.9753,358.8618,25,1,120000); CreateVehicle(435,2133.0686,-2092.4158,14.1329,136.8398,25,1,120000); CreateVehicle(435,2126.2871,-2085.7627,14.1308,135.2913,25,1,120000); CreateVehicle(435,2118.7998,-2078.5063,14.1431,136.4138,25,1,120000); CreateVehicle(408,1768.9283,-2032.1532,14.2805,270.4727,26,26,120000); CreateVehicle(408,1769.2151,-2048.5842,14.2831,270.8420,26,26,120000); CreateVehicle(408,1788.3578,-2024.2463,14.0245,178.3893,26,26,120000); CreateVehicle(408,1795.2281,-2024.2175,14.0413,179.2720,26,26,120000); //Next vehicle was for test purposes - DELETE CreateVehicle(402,1481.0980,-1737.9425,13.5469,179.2720,26,26,120000); return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, 1795.2281,-2024.2175,14.0413); SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746); return 1; } public OnPlayerConnect(playerid) { SendClientMessage(playerid, 0xAA3333AA, "Rhys' Testing Script"); return 1; } public OnPlayerDisconnect(playerid, reason) { return 1; } public OnPlayerSpawn(playerid) { return 1; } public OnPlayerDeath(playerid, killerid, reason) { return 1; } public OnVehicleSpawn(vehicleid) { return 1; } public OnVehicleDeath(vehicleid, killerid) { return 1; } public OnPlayerText(playerid, text[]) { return 1; } public OnPlayerCommandText(playerid, cmdtext[]) //City hall & Jobs { if (strcmp("/jobs", cmdtext, true, 10) == 0) { if (IsPlayerInRangeOfPoint(playerid, 10, 363.4658,173.8406,1008.3828)) ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Available Employment","1)Trucker\n2)Pizzaboy\n3)Trashman","Select","Cancel"); return 1; } if (strcmp("/enter", cmdtext, true, 10) ==0) { if (IsPlayerInRangeOfPoint(playerid, 10,1481.0565,-1771.2000,18.7958)) SetPlayerPos(playerid,387.9753,173.5708,1008.3828); SetPlayerInterior(playerid, 3); return 1; } if (strcmp("/exit", cmdtext,true, 10) ==0) { if (IsPlayerInRangeOfPoint(playerid, 10,387.9753,173.5708,1008.3828)) SetPlayerPos(playerid,1481.0565,-1771.2000,18.7958); SetPlayerInterior(playerid,0); return 1; } if (strcmp("/jobhelp",cmdtext,true,10) ==0) { if (job[playerid] == 1) { SendClientMessage(playerid,0xAFAFAFAA,"-----------Trucker Job-----------"); SendClientMessage(playerid,0xAFAFAFAA,"/jobbegin, /jobend"); SendClientMessage(playerid,0xAFAFAFAA,"/helpme if you need any more assistance"); return 1; } else if (job[playerid] == 2) { SendClientMessage(playerid,0xAFAFAFAA,"-----------Pizzaboy Job-----------"); SendClientMessage(playerid,0xAFAFAFAA,"/jobbegin, /jobend"); SendClientMessage(playerid,0xAFAFAFAA,"/helpme if you need any more assistance"); return 1; } else if (job[playerid] == 3) { SendClientMessage(playerid,0xAFAFAFAA,"-----------Trashmaster Job-----------"); SendClientMessage(playerid,0xAFAFAFAA,"/jobbegin, /jobend"); SendClientMessage(playerid,0xAFAFAFAA,"/helpme if you need any more assistance"); return 1; } else if (job[playerid] == 0) { SendClientMessage(playerid,0xAFAFAFAA,"You do not have an occupation. Please go to city hall to apply for a job."); return 1; } } return 0; } public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) { new vModel = GetVehicleModel(GetPlayerVehicleID(playerid)); if (vModel== 403) { if (job[playerid] !=1) RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,0xAA3333AA,"You do not have the trucker job"); } if (vModel==514) { if (job[playerid] != 1) RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,0xAA3333AA,"You do not have the trucker job"); } if (vModel== 448) { if (job[playerid] != 2) RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,0xAA3333AA,"You do not have the pizza-boy job"); } if (vModel== 408) { if (job[playerid] != 3) RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,0xAA3333AA,"You do not have the trashmaster job"); } } return 1; } public OnPlayerEnterCheckpoint(playerid) { return 1; } public OnPlayerLeaveCheckpoint(playerid) { return 1; } public OnPlayerEnterRaceCheckpoint(playerid) { return 1; } public OnPlayerLeaveRaceCheckpoint(playerid) { return 1; } public OnRconCommand(cmd[]) { return 1; } public OnPlayerRequestSpawn(playerid) { return 1; } public OnObjectMoved(objectid) { return 1; } public OnPlayerObjectMoved(playerid, objectid) { return 1; } public OnPlayerPickUpPickup(playerid, pickupid) //City hall & Jobs { { if (pickupid == jobpickup) { GameTextForPlayer(playerid,"~g~ /jobs",5000,1); } } { if(pickupid == cityhallenterpickup) { GameTextForPlayer(playerid,"~r~City Hall",2000,1); } } { if (pickupid == cityhallexitpickup) { GameTextForPlayer(playerid,"~r~City Hall Exit",2000,1); } } return 1; } public OnVehicleMod(playerid, vehicleid, componentid) { return 1; } public OnVehiclePaintjob(playerid, vehicleid, paintjobid) { return 1; } public OnVehicleRespray(playerid, vehicleid, color1, color2) { return 1; } public OnPlayerSelectedMenuRow(playerid, row) { return 1; } public OnPlayerExitedMenu(playerid) { return 1; } public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) { return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { return 1; } public OnRconLoginAttempt(ip[], password[], success) { return 1; } public OnPlayerUpdate(playerid) { return 1; } public OnPlayerStreamIn(playerid, forplayerid) { return 1; } public OnPlayerStreamOut(playerid, forplayerid) { return 1; } public OnVehicleStreamIn(vehicleid, forplayerid) { return 1; } public OnVehicleStreamOut(vehicleid, forplayerid) { return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid==1 && response==1) { switch(listitem) { case 0: { job[playerid] = 1; SendClientMessage(playerid, 0x33AA33AA, "Application accepted. Your new job as a Trucker is waiting! Use /jobhelp for assistance."); } case 1: { job[playerid] = 2; SendClientMessage(playerid, 0x33AA33AA, "Application accepted. Your new job as a Pizzaboy is waiting! Use /jobhelp for assistance."); } case 2: { job[playerid] = 3; SendClientMessage(playerid, 0x33AA33AA, "Application accepted. Your new job as a Trashman is waiting! Use /jobhelp for assistance."); } } } return 1; } public OnPlayerClickPlayer(playerid, clickedplayerid, source) { return 1; }