Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a comment
- // uncomment the line below if you want to write a filterscript
- //#define FILTERSCRIPT
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #include <YSI\y_ini>
- new bool:IsInJob;
- new pickup_job;
- new farecount[MAX_PLAYERS];
- new FareCountTimer[MAX_PLAYERS];
- #define PATH "/Users/%s.ini"
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Blank Filterscript by your name here");
- print("--------------------------------------\n");
- pickup_job = CreatePickup(1275,1,1753.4523,-1894.1350,13.5572,-1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- #endif
- enum pInfos
- {
- pJob,
- pIsPassenger,
- pMoney
- };
- new pInfo[MAX_PLAYERS][pInfos];
- stock UserPath(playerid)
- {
- new string[128],playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid,playername,sizeof(playername));
- format(string,sizeof(string),PATH,playername);
- return string;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- if(pInfo[playerid][pJob] == 1)
- {
- AddPlayerClass(0, 1753.4523,-1894.1350,13.5572,91.6063, 0, 0, 0, 0, 0, 0);
- }
- return 1;
- }
- forward LoadUser_data(playerid,name[],value[]);
- public LoadUser_data(playerid,name[],value[])
- {
- INI_Int("Job",pInfo[playerid][pJob]);
- INI_Int("money",pInfo[playerid][pMoney]);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(pInfo[playerid][pJob] == 1)
- {
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"Job",1);
- INI_WriteInt(File,"money",pInfo[playerid][pMoney]);
- INI_Close(File);
- new amount;
- amount = (farecount[playerid] * 10);
- GivePlayerMoney(playerid,amount);
- pInfo[playerid][pMoney] += amount;
- }
- if(pInfo[playerid][pIsPassenger] == 1)
- {
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"FareAmount",0);
- INI_Close(File);
- new amount;
- amount = (farecount[playerid] * 10);
- GivePlayerMoney(playerid,-amount);
- pInfo[playerid][pMoney] -= amount;
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- new money;
- money = pInfo[playerid][pMoney];
- GivePlayerMoney(playerid,money);
- 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;
- }
- CMD:startfare(playerid,params[])
- {
- new id;
- if(sscanf(params,"d",id)) return SendClientMessage(playerid,-1,"[ ! ] /startfare <id>");
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"[ ! ] Invalid ID!");
- if(pInfo[playerid][pJob] == 1)
- {
- if(GetPlayerVehicleSeat(id) == 0)
- {
- if(GetPlayerVehicleSeat(id) == 1 || GetPlayerVehicleSeat(id) == 2 || GetPlayerVehicleSeat(id) == 3 || GetPlayerVehicleSeat(id) == 4)
- {
- FareCountTimer[playerid] = SetTimer("FareCount",1000,true);
- pInfo[playerid][pIsPassenger] = 1;
- SendClientMessage(playerid,-1,"[ ! ] Fare started for the player.");
- farecount[id] = 0;
- farecount[playerid] = 0;
- }
- else SendClientMessage(playerid,-1,"[ ! ] Player must be on any seat of the car!");
- }
- else SendClientMessage(playerid,-1,"[ ! ] You must be on driving seat");
- }
- return 1;
- }
- forward FareCount(playerid);
- public FareCount(playerid)
- {
- farecount[playerid]++;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- if(pInfo[playerid][pJob] == 1)
- {
- SendClientMessage(playerid,-1,"[ ! ] Welcome to the vehicle");
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"FareAmount",farecount[playerid]);
- INI_Close(File);
- }
- else
- {
- SendClientMessage(playerid,-1,"[ ! ] You may request for fare!");
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"money",pInfo[playerid][pMoney]);
- INI_Close(File);
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- if(farecount[playerid] > 0)
- {
- if(pInfo[playerid][pIsPassenger] == 1)
- {
- new amount;
- amount = (farecount[playerid] * 10);
- GivePlayerMoney(playerid,-amount);
- new str[128];
- farecount[playerid] = 0;
- KillTimer(FareCountTimer[playerid]);
- format(str,sizeof(str),"[ ! ] You lose %d as your fare money!",amount);
- SendClientMessage(playerid,-1,str);
- pInfo[playerid][pMoney] -= amount;
- }
- }
- if(farecount[playerid] > 0)
- {
- if(pInfo[playerid][pJob] == 1)
- {
- new amount;
- amount = (farecount[playerid] * 10);
- GivePlayerMoney(playerid,amount);
- farecount[playerid] = 0;
- new str[128];
- format(str,sizeof(str),"[ ! ] You earn %d as your fare money!",amount);
- SendClientMessage(playerid,-1,str);
- pInfo[playerid][pMoney] += amount;
- KillTimer(FareCountTimer[playerid]);
- }
- }
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- 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)
- {
- if(pickupid == pickup_job)
- {
- if(IsInJob) return SendClientMessage(playerid,-1,"[ ! ] You are already a Public driver");
- if(GetPlayerMoney(playerid) >= 500)
- {
- pInfo[playerid][pJob] = 1;
- IsInJob = true;
- ForceClassSelection(playerid);
- TogglePlayerSpectating(playerid, true);
- TogglePlayerSpectating(playerid, false);
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"Job",true);
- INI_WriteInt(File,"money",pInfo[playerid][pMoney]);
- INI_Close(File);
- }
- }
- 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[])
- {
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement