Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <dini>
- #include <zcmd>
- #define Permise "Permise/%s.ini"
- new Permis[MAX_PLAYERS], Exam[MAX_PLAYERS], examveh[MAX_PLAYERS];
- new Float:Scoala[] = {1025.4070,-1551.1061,13.5502}; //Coordonatele scolii
- new Float:ExamCP[0][3] =
- {
- {0.000, 0.000, 0.000},
- {1034.9841,-1559.0972,12.9315},
- {1034.8450,-1708.3129,12.9540},
- {1295.3475,-1713.5033,12.9473},
- {1295.5015,-1848.9913,12.9391},
- {1184.2592,-1850.2012,12.9736},
- {1062.6892,-1838.3940,13.0227},
- {919.1100,-1766.6110,12.9547},
- {919.1310,-1577.0212,12.9465},
- {1031.4899,-1570.5385,12.9359},
- {1019.7754,-1540.8235,13.0815}
- };
- forward TimerVehicul();
- public OnFilterScriptInit()
- {
- SetTimer("TimerVehicul", 1000, 1);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new file[MAX_PLAYER_NAME+13];
- format(file, MAX_PLAYER_NAME, "Permise/%s.ini", pName(playerid));
- if(!dini_Exists(file))
- {
- dini_Create(file);
- dini_IntSet(file,"Permis",0);
- Permis[playerid] = 0;
- }
- if(dini_Exists(file))
- {
- Permis[playerid] = dini_Int(file,"Permis");
- }
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
- {
- if(Permis[playerid] == 0 && Exam[playerid] == 0)
- {
- SendClientMessage(playerid, -1, "Nu stii sa conduci. Nu ai permis. Dute la scoala de soferi");
- RemovePlayerFromVehicle(playerid);
- SetPlayerCheckpoint(playerid, Scoala[0], Scoala[1], Scoala[2], 3.0);
- }
- }
- if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
- {
- if(Exam[playerid] >= 1)
- {
- Picat(playerid);
- }
- }
- return 1;
- }
- stock Picat(playerid)
- {
- Exam[playerid] = 0;
- SendClientMessage(playerid, -1, "Ai picat examenul ca te-ai dat jos din vehicul");
- DestroyVehicle(examveh[playerid]);
- DisablePlayerCheckpoint(playerid);
- }
- stock pName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- return name;
- }
- CMD:exam(playerid,command[])
- {
- if(!(IsPlayerInRangeOfPoint(playerid, 2.0, Scoala[0], Scoala[1], Scoala[2]))) return SendClientMessage(playerid, -1, "Nu esti la scoala de soferi");
- if(Permis[playerid] != 0) return SendClientMessage(playerid, -1, "Ai deja premis");
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- examveh[playerid] = CreateVehicle(405, x, y, z, 0.000, -1, -1, -1);
- Exam[playerid] = 1;
- PutPlayerInVehicle(playerid, examveh[playerid], 0);
- SetPlayerCheckpoint(playerid, ExamCP[Exam[playerid]][0], ExamCP[Exam[playerid]][1], ExamCP[Exam[playerid]][2], 2.0);
- SendClientMessage(playerid, -1, "Ai inceput examenul pentru permis. Urmareste checkpoint-urile cu atentie");
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- if(Exam[playerid] >= 1)
- {
- if(Exam[playerid] == sizeof(ExamCP))
- {
- new file[MAX_PLAYER_NAME+13];
- format(file, MAX_PLAYER_NAME, "Permise/%s.ini", pName(playerid));
- DisablePlayerCheckpoint(playerid);
- SendClientMessage(playerid, -1, "Felicitari. Ai luat permisul de conducere");
- Permis[playerid] = 1;
- dini_IntSet(file,"Permis",Permis[playerid]);
- RemovePlayerFromVehicle(playerid);
- DestroyVehicle(examveh[playerid]);
- Exam[playerid] = 0;
- return 1;
- }
- Exam[playerid]++;
- SetPlayerCheckpoint(playerid, ExamCP[Exam[playerid]][0], ExamCP[Exam[playerid]][1], ExamCP[Exam[playerid]][2], 2.0);
- }
- return 1;
- }
- public TimerVehicul()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(Exam[i] > 0)
- {
- new Float:Vviata;
- GetVehicleHealth(examveh[i], Vviata);
- if(Vviata < 750)
- {
- Picat(i);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement