Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- */
- //==============================================================================
- #include <a_samp>
- #include <Dini>
- #include <foreach>
- //==============================================================================
- #pragma tabsize 0
- //==============================================================================
- #define MAX_WEED 5000 //Weed Limit
- //==============================================================================
- #define CHECKPOINT_NONE 0 //No Checkpoint
- //==============================================================================
- #define COLOR_GRAD1 0xB4B5B7FF
- #define COLOR_GRAD2 0xBFC0C2FF
- #define COLOR_GRAD3 0xCBCCCEFF
- #define COLOR_GRAD4 0xD8D8D8FF
- #define COLOR_GRAD5 0xE3E3E3FF
- #define COLOR_GRAD6 0xF0F0F0FF
- #define COLOR_GREY 0xAFAFAFAA
- //==============================================================================
- #define COLOR_FADE1 0xE6E6E6E6
- #define COLOR_FADE2 0xC8C8C8C8
- #define COLOR_FADE3 0xAAAAAAAA
- #define COLOR_FADE4 0x8C8C8C8C
- #define COLOR_FADE5 0x6E6E6E6E
- #define COLOR_PURPLE 0xC2A2DAAA
- //==============================================================================
- forward InitPlayer(playerid);
- forward SaveDrugs(playerid);
- forward LoadDrugs(playerid);
- forward ShowDrugs(playerid,targetid);
- forward WeedTimer();
- forward Plantation();
- forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
- forward TimerPlantou();
- //==============================================================================
- stock PlayerName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- //==============================================================================
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- //==============================================================================
- GiveNameSpace(str[])
- {
- new strl;
- strl=strlen(str);
- while(strl--) {
- if(str[strl]=='_') str[strl]=' ';
- }
- return 0;
- }
- //==============================================================================
- enum pInfo
- {
- sWeed,
- sSeeds
- };
- new PlayerInfo[MAX_PLAYERS][pInfo];
- //==============================================================================
- enum weedInfo
- {
- WeedPlanter[MAX_PLAYER_NAME],
- Float:WeedX,
- Float:WeedY,
- Float:WeedZ,
- WeedTime,
- WeedPlanted,
- };
- new WeedInfo[MAX_WEED][weedInfo];
- new WEEDS[MAX_PLAYERS];
- new WATER[MAX_PLAYERS];
- new WATERS[MAX_PLAYERS];
- new Weeder[MAX_PLAYERS];
- new weedObject[MAX_WEED];
- new plantou;
- //==============================================================================
- public TimerPlantou()
- {
- plantou = 0;
- return 1;
- }
- //==============================================================================
- public InitPlayer(playerid) {
- PlayerInfo[playerid][sWeed] = 0;
- WATERS[playerid] = 0;
- WEEDS[playerid] = 0;
- WATER[playerid] = 0;
- Weeder[playerid] = 0;
- return 1;
- }
- //==============================================================================
- public WeedTimer()
- {
- foreach (Player,i)
- {
- if(Weeder[i] > 0)
- {
- Weeder[i] --;
- }
- }
- return 1;
- }
- //==============================================================================
- public Plantation()
- {
- for(new b = 0; b < sizeof(WeedInfo); b++)
- {
- if(WeedInfo[b][WeedTime] > 0 && WeedInfo[b][WeedPlanted] == 1)
- {
- WeedInfo[b][WeedTime] -= 1;
- }
- }
- return 1;
- }
- //==============================================================================
- public OnFilterScriptInit()
- {
- AddStaticPickup(1239, 2, 2454.9827,-1708.3074,13.613);
- Create3DTextLabel("[/Comprar]",0xFF9F40FF,2454.9827,-1708.3074,13.613+0.75,20.0,0,1);
- SetTimer("Plantation", 80000, 1);
- CreateObject(3439,2542.60009766,-1587.80004883,22.00000000,0.00000000,0.00000000,0.00000000);
- {
- print(" Scarface/Titanic's Drug System 2010 ");
- return 1;
- }
- }
- //==============================================================================
- public OnFilterScriptExit()
- {
- return 1;
- }
- //==============================================================================
- public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
- {
- if(IsPlayerInRangeOfPoint(playerid, radi, x, y, z))
- {
- return 1;
- }
- return 0;
- }
- //==============================================================================
- public SaveDrugs(playerid)
- {
- if(IsPlayerConnected(playerid) == 1)
- {
- new string[64];
- format(string, sizeof(string), "LARP/Drugs/%s.ini", PlayerName(playerid));
- if(dini_Create(string))
- {
- dini_IntSet(string, "Cannabis", PlayerInfo[playerid][sWeed]);
- }
- }
- return 1;
- }
- //==============================================================================
- public LoadDrugs(playerid)
- {
- new string2[64];
- format(string2, sizeof(string2), "LARP/Drugs/%s.ini", PlayerName(playerid));
- new playername2[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername2, sizeof(playername2));
- {
- PlayerInfo[playerid][sWeed] = dini_Int(string2,"Cannabis");
- }
- return 1;
- }
- //==============================================================================
- public OnPlayerConnect(playerid)
- {
- LoadDrugs(playerid);
- ResetPlayerWeapons(playerid);
- return 1;
- }
- //==============================================================================
- public OnPlayerDisconnect(playerid, reason)
- {
- SaveDrugs(playerid);
- ResetPlayerWeapons(playerid);
- return 1;
- }
- //==============================================================================
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new playername[MAX_PLAYER_NAME];
- new tmp[256];
- new string[64];
- new cmd[256];
- new idx;
- new sendername[MAX_PLAYER_NAME];
- cmd = strtok(cmdtext, idx);
- //==============================================================================
- if(strcmp("/plantarsemente", cmd, true) == 0)
- if (IsPlayerInRangeOfPoint(playerid, 5.0,2542.60009766,-1587.80004883,22.00000000))
- {
- tmp = strtok(cmdtext, idx);
- if (!WEEDS[playerid]) return SendClientMessage(playerid, COLOR_GREY," Você não tem nenhuma semente.");
- if (!WATER[playerid]) return SendClientMessage(playerid, COLOR_GREY," Você não tem água.");
- if(plantou == 1) return SendClientMessage(playerid, COLOR_GREY, " Parece que alguem já plantou, aguarde mais um pouco."); // Começo do Comando
- plantou = 1;
- if (strcmp("Cannabis", tmp, true) == 0)
- {
- for(new weed = 0; weed < sizeof(WeedInfo); weed++)
- {
- if(WeedInfo[weed][WeedPlanted] == 0 && WeedInfo[weed][WeedTime] == 0)
- {
- if (GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_GRAD2, "Você não deve estar dentro de um carro!");
- new Float:X,Float:Y,Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerName(playerid, playername, 24);
- ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
- weedObject[weed] = CreateObject(3409, X, Y, Z-2, 0, 0, 0);
- Weeder[playerid] = 120;
- WeedInfo[weed][WeedX] = X;
- WeedInfo[weed][WeedY] = Y;
- WeedInfo[weed][WeedZ] = Z;
- WeedInfo[weed][WeedTime] = 2;
- WeedInfo[weed][WeedPlanted] = 1;
- strmid(WeedInfo[weed][WeedPlanter], playername, 0, strlen(playername), 50);
- SendClientMessage(playerid,COLOR_FADE1,"Você plantou uma semente, espere 2 minutos para poder apanha-la.");
- SendClientMessage(playerid,COLOR_FADE1,"Lembre-se de apanhar a sua droga antes que alguem o faça!");
- WEEDS[playerid] = 0;
- WATER[playerid] = 0;
- SetTimer("TimerPlantou",300000,false);
- return 1;
- }
- }
- }
- else SendClientMessage(playerid, COLOR_GRAD1,"Cmd certo: /plantarsemente");
- return 1;
- }
- //==============================================================================
- if(strcmp(cmdtext, "/apanharcannabis", true)==0)
- if (IsPlayerInRangeOfPoint(playerid, 5.0,2542.60009766,-1587.80004883,22.00000000))
- {
- for(new i = 0; i < sizeof(WeedInfo); i++)
- {
- if (PlayerToPoint(9.0,playerid,WeedInfo[i][WeedX],WeedInfo[i][WeedY],WeedInfo[i][WeedZ]))
- {
- if(WeedInfo[i][WeedTime] > 0)
- {
- format(string, sizeof(string), "A planta ainda não está pronta. %d Minutos restantes até estar pronta", WeedInfo[i][WeedTime]);
- SendClientMessage(playerid,COLOR_GRAD1,string);
- return 1;
- }
- ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
- SendClientMessage(playerid,COLOR_GRAD2,"Você apanhou 20 gramas de cannabis.");
- PlayerInfo[playerid][sWeed] += 20;
- DestroyObject(weedObject[i]);
- WeedInfo[i][WeedX] = 0.0;
- WeedInfo[i][WeedY] = 0.0;
- WeedInfo[i][WeedZ] = 0.0;
- WeedInfo[i][WeedPlanted] = 0;
- strmid(WeedInfo[i][WeedPlanter], "[NONE]", 0, strlen("[NONE]"), 128);
- return 1;
- }
- }
- return 1;
- }
- //==============================================================================
- if(strcmp(cmd, "/comprar", true) == 0) //
- {
- if(IsPlayerConnected(playerid))
- {
- if (PlayerToPoint(5.0, playerid, 2454.9827,-1708.3074,13.6137))
- {
- new x_nr[256];
- x_nr = strtok(cmdtext, idx);
- if(!strlen(x_nr))
- {
- SendClientMessage(playerid, COLOR_FADE3, "USO: /comprar [ 1 / 2 ]");
- SendClientMessage(playerid, COLOR_FADE2, "|_______Drug Nest_______|");
- SendClientMessage(playerid, COLOR_FADE1, "| 1: Seed $10 2: Water $5");
- return 1;
- }
- if(strcmp(x_nr,"1",true) == 0 && GetPlayerMoney(playerid)>=10)
- {
- if(WEEDS[playerid] == 1)
- {
- SendClientMessage(playerid,COLOR_GREY,"Você já tem uma semente!");
- return 1;
- }
- GivePlayerMoney(playerid, - 10);
- SendClientMessage(playerid,COLOR_GRAD1,"[INFO]: Você comprou uma semente.");
- WEEDS[playerid] = 1;
- }
- else if(strcmp(x_nr,"2",true) == 0 && GetPlayerMoney(playerid)>=5)
- {
- if(WATER[playerid] == 1)
- {
- SendClientMessage(playerid,COLOR_GREY,"Você já tem água!");
- return 1;
- }
- GivePlayerMoney(playerid, - 5);
- SendClientMessage(playerid,COLOR_GRAD1,"[INFO]: Você comprou água.");
- WATER[playerid] = 1;
- } else {
- SendClientMessage(playerid,COLOR_GRAD2,"Você não tem tanto dinheiro!");
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD3, "Você não está nas traseiras da casa do Ryder!");
- return 1;
- }
- }
- return 1;
- }
- //==============================================================================
- if(strcmp(cmd, "/minhaerva", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- format(string, sizeof(string), "* %s abre a sua mala e olha lá para dentro.", sendername);
- ShowDrugs(playerid,playerid);
- }
- return 1;
- }
- if(strcmp(cmd, "/savedrugs", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- GetPlayerName(playerid, playername, sizeof(playername));
- format(string, sizeof(string), "LARP/Drugs/%s.ini", playername);
- }
- return 1;
- }
- return 0;
- }
- //==============================================================================
- public ShowDrugs(playerid,targetid)
- {
- if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
- {
- new weed = PlayerInfo[targetid][sWeed];
- new name[MAX_PLAYER_NAME];
- GetPlayerName(targetid, name, sizeof(name));
- GiveNameSpace(name);
- new coordsstring[256];
- format(coordsstring, sizeof(coordsstring),"___________________|Mala de %s |___________________",name);
- SendClientMessage(playerid, COLOR_GRAD2,coordsstring);
- format(coordsstring, sizeof(coordsstring), "[Drogas]: Cannabis:[%d]", weed);
- SendClientMessage(playerid, COLOR_GRAD1,coordsstring);
- }
- }
Add Comment
Please, Sign In to add comment