Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <dini>
- #include <zcmd>
- #define WEAPON_ROB WEAPON_SHOTGUN // arma rob
- #define TIME_ROB 60000 // 60
- #define TIMING_ROB 30 // cat dureaza rob-ul(secunde)
- new TimeRob[MAX_PLAYERS], PradaRob[MAX_PLAYERS], Wanted[MAX_PLAYERS];
- forward Rob(playerid);
- forward TimerRob();
- new Float:LocatiiRob[][3] =
- {
- {2310.9670,-8.1712,26.7422},//banca
- {309.4031,-8.3204,26.7422}//bijuterie
- };
- public OnFilterScriptInit()
- {
- SetTimer("TimerRob", 1000, 1);
- return 1;
- }
- public TimerRob()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(TimeRob[i] > 0)
- TimeRob[i]--;
- }
- }
- }
- public OnPlayerConnect(playerid)
- {
- TimeRob[playerid] = 0;
- PradaRob[playerid] = 0;
- Wanted[playerid] = 0;
- new file[MAX_PLAYER_NAME+13];
- format(file, MAX_PLAYER_NAME, "Rob/%s.ini", pName(playerid));
- if(!dini_Exists(file))
- {
- dini_Create(file);
- dini_IntSet(file,"TimeRob",0);
- dini_IntSet(file,"PradaRob",0);
- dini_IntSet(file,"Wanted",0);
- }
- if(dini_Exists(file))
- {
- TimeRob[playerid] = dini_Int(file,"TimeRob");
- PradaRob[playerid] = dini_Int(file,"PradaRob");
- Wanted[playerid] = dini_Int(file,"Wanted");
- }
- return 1;
- }
- stock pName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- return name;
- }
- CMD:rob(playerid,command[])
- {
- new string[43];
- if(TimeRob[playerid] > 0)
- {
- format(string, sizeof(string), "Deabia ai jefuit, trebuie sa astepti %d secunde", TimeConvert(TimeRob[playerid]));
- return SendClientMessage(playerid, -1, string);
- }
- if(GetPlayerLocation(playerid) == -1) return SendClientMessage(playerid, -1, "Nu te aflii la o locatie pentru Rob");
- if(GetPlayerWeapon(playerid) != WEAPON_ROB) return SendClientMessage(playerid, -1, "Iti trebuie shotgun pentru a jefui. Du-te si cumpara unul.");
- ApplyAnimation(playerid, "SHOP", "ROB_Loop_Threat", 4.0, 0, 0, 0, 0, 0); // Rob
- TogglePlayerControllable(playerid,0);
- GameTextForPlayer(playerid, "Jefuind...", TIMING_ROB*1000, 0);
- format(string, sizeof(string), "%s este in cursul unui jaf",pName(playerid));
- SendClientMessageToAll(-1, string);
- SetTimerEx("Rob", TIMING_ROB*1000, 0, "i", playerid);
- return 1;
- }
- public Rob(playerid)
- {
- new bani = randomEx(10000, 100000);
- new reuseste = randomEx(1,3), string[64];
- TogglePlayerControllable(playerid,1);
- switch(reuseste)
- {
- case 1:
- {
- SendClientMessage(playerid, -1, "Casierul a lesinat si nu ai mai furat bijuteriile/");
- TimeRob[playerid] = TIME_ROB*60;
- SaveRob(playerid);
- Wanted[playerid] = 4;
- SetPlayerWantedLevel(playerid, 4);
- }
- case 2:
- {
- SendClientMessage(playerid, -1, "Nu sunt bani, in casa de marcat. Politia vine dupa tine");
- TimeRob[playerid] = TIME_ROB*60;
- SaveRob(playerid);
- Wanted[playerid] = 4;
- SetPlayerWantedLevel(playerid, 4);
- }
- case 3:
- {
- SetPlayerWantedLevel(playerid, 4);
- Wanted[playerid] = 4;
- SendClientMessage(playerid, -1, "Nu sunt bani in casa de marcat.");
- TimeRob[playerid] = TIME_ROB*60;
- PradaRob[playerid] = bani;
- SaveRob(playerid);
- format(string, sizeof(string), "Ai furat %d $. Fugi si du-i in siguranta", bani);
- SendClientMessage(playerid, -1, string);
- SetPlayerCheckpoint(playerid, 1422.6359,-1319.3135,13.1266,2.0);
- }
- }
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- new string[256];
- if(IsPlayerInRangeOfPoint(playerid, 5.0, 1422.6359,-1319.3135,13.1266))
- {
- if(PradaRob[playerid] > 0)
- {
- DisablePlayerCheckpoint(playerid);
- format(string, sizeof(string), "Ai furat cu succes %d", PradaRob[playerid]);
- SendClientMessage(playerid, -1, string);
- GivePlayerMoney(playerid, PradaRob[playerid]);
- PradaRob[playerid] = 0;
- }
- }
- return 1;
- }
- stock GetPlayerLocation(playerid)
- {
- new found = -1, l;
- for(l = 0; l < sizeof(LocatiiRob); l++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 5.0, LocatiiRob[l][0], LocatiiRob[l][1], LocatiiRob[l][2]))
- {
- found = l; break;
- }
- }
- if(found == -1)
- return -1;
- else
- return l;
- }
- stock randomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum;
- stock TimeConvert(time)
- {
- new minutes;
- new seconds;
- new string[128];
- if(time > 59){
- minutes = floatround(time/60);
- seconds = floatround(time - minutes*60);
- if(seconds>9)format(string,sizeof(string),"%d:%d",minutes,seconds);
- else format(string,sizeof(string),"%d:0%d",minutes,seconds);
- }
- else{
- seconds = floatround(time);
- if(seconds>9)format(string,sizeof(string),"0:%d",seconds);
- else format(string,sizeof(string),"0:0%d",seconds);
- }
- return string;
- }
- stock SaveRob(playerid)
- {
- new file[MAX_PLAYER_NAME+13];
- format(file, MAX_PLAYER_NAME, "Rob/%s.ini", pName(playerid));
- dini_IntSet(file,"TimeRob",TimeRob[playerid]);
- dini_IntSet(file,"PradaRob",PradaRob[playerid]);
- dini_IntSet(file,"Wanted",Wanted[playerid]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement