30.04.2009, 19:54
For those people who wants to have something like a little drugsystem on their server
INCLUDES:
/dd = became dealer
/dd0 = cancel being dealer
/drugs = drugs you can buys when you are a dealer (weed , alcohol, steroids, crack)(PS:Crack is /rocks)
/sweed[playerid] & /salcohol[playerid] & /ssteroids[playerid] & /srocks[playerid] = sell a drug you buyed before
...only able if another player requested a drug and if you are a dealer!)
/rweed[playerid] & /ralcohol[playerid] & /rsteroids[playerid] & /rrocks[playerid] = request a drug
/tweed & /talcohol & /tsteroids & /trocks = Allows you to take a drug you buyed (PS: Animations are not really good ... only the animation for
crack is good ... make some for yourself
I added this, because many people in this forum helped me in front of my problems xD
and this is my way to thank you all =)
PS:TOTALLY SELF SCRIPTED
Bearfist
INCLUDES:
/dd = became dealer
/dd0 = cancel being dealer
/drugs = drugs you can buys when you are a dealer (weed , alcohol, steroids, crack)(PS:Crack is /rocks)
/sweed[playerid] & /salcohol[playerid] & /ssteroids[playerid] & /srocks[playerid] = sell a drug you buyed before
...only able if another player requested a drug and if you are a dealer!)
/rweed[playerid] & /ralcohol[playerid] & /rsteroids[playerid] & /rrocks[playerid] = request a drug
/tweed & /talcohol & /tsteroids & /trocks = Allows you to take a drug you buyed (PS: Animations are not really good ... only the animation for
crack is good ... make some for yourself
Код:
//---------------------------------------DDEALER----------------------------------------------------------------------- if(strcmp("/dd",cmdtext,true) == 0) { GetPlayerName(playerid,name,sizeof(name)); if(drugdealer[playerid] == 0) { drugdealer[playerid] = 1; SendClientMessage(playerid,COLOR_YELLOW,"What Up Thug...Get Some Drugs by Press /drugs"); } return 1; } if(strcmp("/dd0",cmdtext,true) == 0) { drugdealer[playerid] = 0; SendClientMessage(playerid,COLOR_WHITE,"You Are A DrugDealer No More!"); return 1; } //--------------------------SHOW------------------------DRUGS---------------------------- if(strcmp("/drugs",cmdtext,true) == 0) { if(drugdealer[playerid] == 1) { SendClientMessage(playerid,COLOR_GREEN,"Press /weed To Get some Hashisch"); SendClientMessage(playerid,COLOR_GREEN,"Press /alcohol To Get some Alcohol"); SendClientMessage(playerid,COLOR_GREEN,"Press /steroids To Get some Anabolics"); SendClientMessage(playerid,COLOR_GREEN,"Press /rocks To Get some Crack"); SendClientMessage(playerid,COLOR_GREEN,"Press /itemd To Show Your Own Drugs"); } else { SendClientMessage(playerid,COLOR_RED,"You Ain't A DrugDealer!"); } return 1; } //------------------------------BUY-------------DRUGS--------------------------------- if(strcmp("/weed",cmdtext,true) == 0) { if(drugdealer[playerid] == 1) { GivePlayerMoney(playerid,-100); weed[playerid] +=1; format(string,sizeof(string),"You Have %d Gramms of Weed",weed[playerid]); SendClientMessage(playerid,COLOR_GREEN,string); } else { SendClientMessage(playerid,COLOR_RED,"You Ain't A DrugDealer!"); } return 1; } if(strcmp("/alcohol",cmdtext,true) == 0) { if(drugdealer[playerid] == 1) { GivePlayerMoney(playerid,-50); alcohol[playerid] +=1; format(string,sizeof(string),"You Have %d Liters of Alcohol",alcohol[playerid]); SendClientMessage(playerid,COLOR_GREEN,string); } else { SendClientMessage(playerid,COLOR_RED,"You Ain't A DrugDealer!"); } return 1; } if(strcmp("/steroids",cmdtext,true) == 0) { if(drugdealer[playerid] == 1) { GivePlayerMoney(playerid,-150); steroids[playerid] +=1; format(string,sizeof(string),"You Have %d Gramms of Steroids",steroids[playerid]); SendClientMessage(playerid,COLOR_GREEN,string); } else { SendClientMessage(playerid,COLOR_RED,"You Ain't A DrugDealer!"); } return 1; } if(strcmp("/rocks",cmdtext,true) == 0) { if(drugdealer[playerid] == 1) { GivePlayerMoney(playerid,75); crack[playerid] +=1; format(string,sizeof(string),"You Have %d rocks of Cracks",crack[playerid]); SendClientMessage(playerid,COLOR_GREEN,string); } else { SendClientMessage(playerid,COLOR_RED,"You Ain't A DrugDealer!"); } return 1; } if(strcmp("/itemd",cmdtext,true) == 0) { format(string,sizeof(string),"Weed:%d",weed[playerid]); SendClientMessage(playerid,COLOR_GREEN,string); format(string,sizeof(string),"Alcohol:%d",alcohol[playerid]); SendClientMessage(playerid,COLOR_GREEN,string); format(string,sizeof(string),"Steroids:%d",steroids[playerid]); SendClientMessage(playerid,COLOR_GREEN,string); format(string,sizeof(string),"Crack:%d",crack[playerid]); SendClientMessage(playerid,COLOR_GREEN,string); return 1; } //----------------TAKE---------------------DRUGS---------------------------------------------- if(strcmp("/tweed",cmdtext,true) == 0) { if(weed[playerid] >= 1) { if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { ApplyAnimation(playerid,"SMOKING","F_smklean_loop",4.1,1,1,1,1,1); ApplyAnimation(playerid,"SMOKING","M_smklean_loop",4.1,1,1,1,1,1); ApplyAnimation(playerid,"SMOKING","M_smkstnd_loop",4.1,1,1,1,1,1); ApplyAnimation(playerid,"SMOKING","M_smk_drag",4.1,1,1,1,1,1); ApplyAnimation(playerid,"SMOKING","M_smk_in",4.1,1,1,1,1,1); ApplyAnimation(playerid,"SMOKING","M_smk_loop",4.1,1,1,1,1,1); ApplyAnimation(playerid,"SMOKING","M_smk_out",4.1,1,1,1,1,1); ApplyAnimation(playerid,"SMOKING","M_smk_tap",4.1,1,1,1,1,1); weed[playerid] -=1; SendClientMessage(playerid,COLOR_WHITE,"You Smoke you complete Gramm Weed o.O!^^"); return 1; } } else { SendClientMessage(playerid,COLOR_RED,"You Don't Have Weed!"); return 1; } } if(strcmp("/talcohol",cmdtext,true) == 0) { if(alcohol[playerid] >= 1) { if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1); alcohol[playerid] -=1; SendClientMessage(playerid,COLOR_WHITE,"You Are Drunked!"); return 1; } } else { SendClientMessage(playerid,COLOR_RED,"You Don't Have Alcohol!"); return 1; } } if(strcmp("/tsteroids",cmdtext,true) == 0) { if(steroids[playerid] >= 1) { if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { //ApplyAnimation(playerid,"MUSCULAR","MscleWalkst_armed",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","MscleWalkst_Csaw",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","Mscle_rckt_run",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","Mscle_rckt_walkst",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","Mscle_run_Csaw",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","MuscleIdle",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","MuscleIdle_armed",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","MuscleIdle_Csaw",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","MuscleIdle_rocket",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","MuscleRun",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","MuscleRun_armed",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","MuscleSprint",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","MuscleWalk",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","MuscleWalkstart",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","MuscleWalk_armed",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","Musclewalk_Csaw",4.1,1,1,1,1,1); //ApplyAnimation(playerid,"MUSCULAR","Musclewalk_rocket",4.1,1,1,1,1,1); steroids[playerid] -=1; SendClientMessage(playerid,COLOR_WHITE,"See more Muscels huh?"); return 1; } } else { SendClientMessage(playerid,COLOR_RED,"You Don't Have Steroids!"); } return 1; } if(strcmp("/trocks",cmdtext,true) == 0) { if(crack[playerid] >= 1) { if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { ApplyAnimation(playerid,"CRACK","Bbalbat_Idle_01",4.1,1,1,1,1,1); ApplyAnimation(playerid,"CRACK","Bbalbat_Idle_02",4.1,1,1,1,1,1); ApplyAnimation(playerid,"CRACK","crckdeth1",4.1,1,1,1,1,1); ApplyAnimation(playerid,"CRACK","crckdeth2",4.1,1,1,1,1,1); ApplyAnimation(playerid,"CRACK","crckdeth3",4.1,1,1,1,1,1); ApplyAnimation(playerid,"CRACK","crckdeth4",4.1,1,1,1,1,1); ApplyAnimation(playerid,"CRACK","crckidle1",4.1,1,1,1,1,1); ApplyAnimation(playerid,"CRACK","crckidle2",4.1,1,1,1,1,1); ApplyAnimation(playerid,"CRACK","crckidle3",4.1,1,1,1,1,1); ApplyAnimation(playerid,"CRACK","crckidle4",4.1,1,1,1,1,1); crack[playerid]-=1; SendClientMessage(playerid,COLOR_WHITE,"You smoke your Crack...Everything is so Peaceful! xD"); return 1; } } else { SendClientMessage(playerid,COLOR_RED,"You Don't Have Crack!"); return 1; } } //-------------------SELL----------------------DRUGS------------------------------------------- if(strcmp("/sweed",cmd,true) == 0) { tmp = strtok(cmdtext,index); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_RED,"Usage: /sweed[playerid]"); return 1; } //new giveplayerid = ReturnUser(tmp); if(giveplayerid != INVALID_PLAYER_ID) { if(drugdealer[playerid] == 1) { if(weed[playerid] >= 1) { if(rweed[giveplayerid]==1) { GetPlayerName(playerid,name,sizeof(name)); GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer)); weed[giveplayerid] = weed[giveplayerid]+=1; SendClientMessage(playerid,COLOR_GREEN,"You Selled 1 Gramm of Weed for 130$!"); SendClientMessage(giveplayerid,COLOR_GREEN,"You Became 1 Gramm of Weed and gave 130$"); GivePlayerMoney(playerid,130); GivePlayerMoney(giveplayerid,-130); weed[playerid] = weed[playerid]-=1; rweed[giveplayerid] -=1; } else { format(string,sizeof(string),"%s doesn't want Weed!",name); SendClientMessage(playerid,COLOR_RED,string); } } else { SendClientMessage(playerid,COLOR_RED,"You Don't Have Weed!"); } } else { SendClientMessage(playerid,COLOR_RED,"You Ain't A DrugDealer!"); } } else if(giveplayerid == INVALID_PLAYER_ID) { SendClientMessage(playerid,COLOR_RED,"This Player Doesn't Exists"); } return 1; } if(strcmp("/salcohol",cmd,true) == 0) { tmp = strtok(cmdtext,index); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_RED,"Usage: /salcohol[playerid]"); return 1; } //new giveplayerid = ReturnUser(tmp); if(giveplayerid != INVALID_PLAYER_ID) { if(drugdealer[playerid] == 1) { if(alcohol[playerid] >= 1) { if(ralcohol[giveplayerid]==1) { GetPlayerName(playerid,name,sizeof(name)); GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer)); alcohol[giveplayerid] = alcohol[giveplayerid]+=1; SendClientMessage(playerid,COLOR_GREEN,"You Selled 1 Liter Alcohol for 80$!"); SendClientMessage(giveplayerid,COLOR_GREEN,"You Became 1 Liter Alcohol and gave 80$"); GivePlayerMoney(playerid,80); GivePlayerMoney(giveplayerid,-80); alcohol[playerid] = alcohol[playerid]-=1; ralcohol[giveplayerid] -=1; } else { format(string,sizeof(string),"%s doesn't want Alcohol!",name); SendClientMessage(playerid,COLOR_RED,string); } } else { SendClientMessage(playerid,COLOR_RED,"You Don't Have Alcohol!"); } } else { SendClientMessage(playerid,COLOR_RED,"You Ain't A DrugDealer!"); } } else if(giveplayerid == INVALID_PLAYER_ID) { SendClientMessage(playerid,COLOR_RED,"This Player Doesn't Exists"); } return 1; } if(strcmp("/ssteroids",cmd,true) == 0) { tmp = strtok(cmdtext,index); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_RED,"Usage: /ssteroids[playerid]"); return 1; } //new giveplayerid = ReturnUser(tmp); if(giveplayerid != INVALID_PLAYER_ID) { if(drugdealer[playerid] == 1) { if(steroids[playerid] >= 1) { if(rsteroids[giveplayerid]==1) { GetPlayerName(playerid,name,sizeof(name)); GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer)); steroids[giveplayerid] = steroids[giveplayerid]+=1; SendClientMessage(playerid,COLOR_GREEN,"You Selled 1 ml Steroids for 200$!"); SendClientMessage(giveplayerid,COLOR_GREEN,"You Became 1 ml steroids and gave 200$"); GivePlayerMoney(playerid,200); GivePlayerMoney(giveplayerid,-200); steroids[playerid] = steroids[playerid]-=1; rsteroids[giveplayerid] -=1; } else { format(string,sizeof(string),"%s doesn't want Steroids!",name); SendClientMessage(playerid,COLOR_RED,string); } } else { SendClientMessage(playerid,COLOR_RED,"You Don't Have Steroids!"); } } else { SendClientMessage(playerid,COLOR_RED,"You Ain't A DrugDealer!"); } } else if(giveplayerid == INVALID_PLAYER_ID) { SendClientMessage(playerid,COLOR_RED,"This Player Doesn't Exists"); } return 1; } if(strcmp("/srocks",cmd,true) == 0) { tmp = strtok(cmdtext,index); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_RED,"Usage: /srocks[playerid]"); return 1; } //new giveplayerid = ReturnUser(tmp); if(giveplayerid != INVALID_PLAYER_ID) { if(drugdealer[playerid] == 1) { if(crack[playerid] >= 1) { if(rcrack[giveplayerid]==1) { GetPlayerName(playerid,name,sizeof(name)); GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer)); crack[giveplayerid] = crack[giveplayerid]+=1; SendClientMessage(playerid,COLOR_GREEN,"You Selled 1 Gramm Crack for 95$!"); SendClientMessage(giveplayerid,COLOR_GREEN,"You Became 1 Gramm of rocks and gave 95$"); GivePlayerMoney(playerid,95); GivePlayerMoney(giveplayerid,-95); crack[playerid] = crack[playerid]-=1; rcrack[giveplayerid] -=1; } else { format(string,sizeof(string),"%s doesn't want Crack!",name); SendClientMessage(playerid,COLOR_RED,string); } } else { SendClientMessage(playerid,COLOR_RED,"You Don't Have Crack!"); } } else { SendClientMessage(playerid,COLOR_RED,"You Ain't A DrugDealer!"); } } else if(giveplayerid == INVALID_PLAYER_ID) { SendClientMessage(playerid,COLOR_RED,"This Player Doesn't Exists"); } return 1; } //-----------------------------Request--Drug--------------------------------------------------------------- if(strcmp("/rweed",cmd,true) == 0) { new player[MAX_PLAYER_NAME]; tmp = strtok(cmdtext,index); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_RED,"Usage:/rweed[playerid]"); return 1; } if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(playerid,player,sizeof(player)), rweed[playerid] =1; format(string,sizeof(string),"%s Wants some Weed!",player); SendClientMessage(giveplayerid,COLOR_WHITE,string); } else if(giveplayerid == INVALID_PLAYER_ID) { SendClientMessage(playerid,COLOR_RED,"That Player doesn't exists!"); } return 1; } if(strcmp("/ralcohol",cmd,true) == 0) { new player[MAX_PLAYER_NAME]; tmp = strtok(cmdtext,index); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_RED,"Usage:/ralcohol[playerid]"); return 1; } if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(playerid,player,sizeof(player)), ralcohol[playerid] =1; format(string,sizeof(string),"%s Wants some Alcohol!",player); SendClientMessage(giveplayerid,COLOR_WHITE,string); } else if(giveplayerid == INVALID_PLAYER_ID) { SendClientMessage(playerid,COLOR_RED,"That Player doesn't exists!"); } return 1; } if(strcmp("/rsteroids",cmd,true) == 0) { new player[MAX_PLAYER_NAME]; tmp = strtok(cmdtext,index); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_RED,"Usage:/rsteroids[playerid]"); return 1; } if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(playerid,player,sizeof(player)), rsteroids[playerid] =1; format(string,sizeof(string),"%s Wants some Steroids!",player); SendClientMessage(giveplayerid,COLOR_WHITE,string); } else if(giveplayerid == INVALID_PLAYER_ID) { SendClientMessage(playerid,COLOR_RED,"That Player doesn't exists!"); } return 1; } if(strcmp("/rrocks",cmd,true) == 0) { new player[MAX_PLAYER_NAME]; tmp = strtok(cmdtext,index); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_RED,"Usage:/rrocks[playerid]"); return 1; } if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(playerid,player,sizeof(player)), rcrack[playerid] =1; format(string,sizeof(string),"%s Wants some crack!",player); SendClientMessage(giveplayerid,COLOR_WHITE,string); } else if(giveplayerid == INVALID_PLAYER_ID) { SendClientMessage(playerid,COLOR_RED,"That Player doesn't exists!"); } return 1; } //-----------------------------------------------------DDEALER------------------------------------------------------
and this is my way to thank you all =)
PS:TOTALLY SELF SCRIPTED
Bearfist