Hello Guyz i've made Fishing System.
here is my fishing system.
Код:
stock randomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum;
dcmd_fsellall(playerid,params[])
{
#pragma unused params
new string[256];
new Houseid = PlayerInfo[playerid][pLastOutSideID];
if(PlayerInfo[playerid][pFishes] < 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You Are Not Carrying Any Fish.");
return 1;
}
if (HouseInfo[Houseid][h_cpbustype] == BUS_TYPE_24_7)
{
if(PlayerInfo[playerid][pFishes] >= 1)
{
switch(random(10))
{
case 0:
{
new FishPrice0 = PlayerInfo[playerid][pFishes]*3432;
GivePlayerMoney(playerid,FishPrice0);
format(string, sizeof(string), "Sold %d Fishes For $%d.",PlayerInfo[playerid][pFishes],FishPrice0);
SendClientMessage(playerid, COLOR_CYAN, string);
format(string, sizeof(string), "~w~Sold ~p~%d Fishes~n~~w~Recieved~g~ $%d",PlayerInfo[playerid][pFishes],FishPrice0);
GameTextForPlayer(playerid,string, 5000, 3);
PlayerInfo[playerid][pFishes]=0;
}
case 1:
{
new FishPrice1 = PlayerInfo[playerid][pFishes]*4545;
GivePlayerMoney(playerid,FishPrice1);
format(string, sizeof(string), "Sold %d Fishes.",PlayerInfo[playerid][pFishes],FishPrice1);
SendClientMessage(playerid, COLOR_CYAN, string);
format(string, sizeof(string), "~w~Sold ~p~%d Fishes~n~~w~Recieved~g~ $%d",PlayerInfo[playerid][pFishes],FishPrice1);
GameTextForPlayer(playerid,string, 5000, 3);
PlayerInfo[playerid][pFishes]=0;
}
case 2:
{
new FishPrice2 = PlayerInfo[playerid][pFishes]*7866;
GivePlayerMoney(playerid,FishPrice2);
format(string, sizeof(string), "Sold %d Fishes.",PlayerInfo[playerid][pFishes],FishPrice2);
SendClientMessage(playerid, COLOR_CYAN, string);
format(string, sizeof(string), "~w~Sold ~p~%d Fishes~n~~w~Recieved~g~ $%d",PlayerInfo[playerid][pFishes],FishPrice2);
GameTextForPlayer(playerid,string, 5000, 3);
PlayerInfo[playerid][pFishes]=0;
}
case 3:
{
new FishPrice3 = PlayerInfo[playerid][pFishes]*8766;
GivePlayerMoney(playerid,FishPrice3);
format(string, sizeof(string), "Sold %d Fishes.",PlayerInfo[playerid][pFishes],FishPrice3);
SendClientMessage(playerid, COLOR_CYAN, string);
format(string, sizeof(string), "~w~Sold ~p~%d Fishes~n~~w~Recieved~g~ $%d",PlayerInfo[playerid][pFishes],FishPrice3);
GameTextForPlayer(playerid,string, 5000, 3);
PlayerInfo[playerid][pFishes]=0;
}
case 4:
{
new FishPrice4 = PlayerInfo[playerid][pFishes]*4555;
GivePlayerMoney(playerid,FishPrice4);
format(string, sizeof(string), "Sold %d Fishes.",PlayerInfo[playerid][pFishes],FishPrice4);
SendClientMessage(playerid, COLOR_CYAN, string);
format(string, sizeof(string), "~w~Sold ~p~%d Fishes~n~~w~Recieved~g~ $%d",PlayerInfo[playerid][pFishes],FishPrice4);
GameTextForPlayer(playerid,string, 5000, 3);
PlayerInfo[playerid][pFishes]=0;
}
case 5:
{
new FishPrice5 = PlayerInfo[playerid][pFishes]*4355;
GivePlayerMoney(playerid,FishPrice5);
format(string, sizeof(string), "Sold %d Fishes.",PlayerInfo[playerid][pFishes], FishPrice5);
SendClientMessage(playerid, COLOR_CYAN, string);
format(string, sizeof(string), "~w~Sold ~p~%d Fishes~n~~w~Recieved~g~ $%d",PlayerInfo[playerid][pFishes],FishPrice5);
GameTextForPlayer(playerid,string, 5000, 3);
PlayerInfo[playerid][pFishes]=0;
}
case 6:
{
new FishPrice6 = PlayerInfo[playerid][pFishes]*4234;
GivePlayerMoney(playerid,FishPrice6);
format(string, sizeof(string), "Sold %d Fishes.",PlayerInfo[playerid][pFishes],FishPrice6);
SendClientMessage(playerid, COLOR_CYAN, string);
format(string, sizeof(string), "~w~Sold ~p~%d Fishes~n~~w~Recieved~g~ $%d",PlayerInfo[playerid][pFishes],FishPrice6);
GameTextForPlayer(playerid,string, 5000, 3);
PlayerInfo[playerid][pFishes]=0;
}
case 7:
{
new FishPrice7 = PlayerInfo[playerid][pFishes]*7656;
GivePlayerMoney(playerid,FishPrice7);
format(string, sizeof(string), "Sold %d Fishes.",PlayerInfo[playerid][pFishes],FishPrice7);
SendClientMessage(playerid, COLOR_CYAN, string);
format(string, sizeof(string), "~w~Sold ~p~%d Fishes~n~~w~Recieved~g~ $%d",PlayerInfo[playerid][pFishes],FishPrice7);
GameTextForPlayer(playerid,string, 5000, 3);
PlayerInfo[playerid][pFishes]=0;
}
case 8:
{
new FishPrice8 = PlayerInfo[playerid][pFishes]*5466;
GivePlayerMoney(playerid,FishPrice8);
format(string, sizeof(string), "Sold %d Fishes.",PlayerInfo[playerid][pFishes],FishPrice8);
SendClientMessage(playerid, COLOR_CYAN, string);
format(string, sizeof(string), "~w~Sold ~p~%d Fishes~n~~w~Recieved~g~ $%d",PlayerInfo[playerid][pFishes],FishPrice8);
GameTextForPlayer(playerid,string, 5000, 3);
PlayerInfo[playerid][pFishes]=0;
}
case 9:
{
new FishPrice9 = PlayerInfo[playerid][pFishes]*7665;
GivePlayerMoney(playerid,FishPrice9);
format(string, sizeof(string), "Sold %d Fishes.",PlayerInfo[playerid][pFishes],FishPrice9);
SendClientMessage(playerid, COLOR_CYAN, string);
format(string, sizeof(string), "~w~Sold ~p~%d Fishes~n~~w~Recieved~g~ $%d",PlayerInfo[playerid][pFishes],FishPrice9);
GameTextForPlayer(playerid,string, 5000, 3);
PlayerInfo[playerid][pFishes]=0;
}
}
}
}
else
{
SendClientMessage(playerid,COLOR_ERROR,"You Can Not Sell Your Fishes Here.");
}
return 1;
}
dcmd_fish(playerid,params[])
{
#pragma unused params
new modelid, vid;
vid = GetPlayerVehicleID(playerid);
modelid = GetVehicleModel(vid);
if(Fishing[playerid] == 1) return SendClientMessage(playerid,COLOR_ERROR,"Please Wait Before Fishing Again.");
if(PlayerInfo[playerid][pFishes] == 15)return SendClientMessage(playerid,COLOR_ERROR,"You Cannot Carry Any More Fishes.");
if (IsSeaVehicle(modelid))
{
Fishing_Timer1[playerid] = SetTimerEx("Fish_Timer", 5000, 0, "d", playerid);
GameTextForPlayer(playerid,"~y~Fishing! ~w~Please Wait...",5000,3);
Fishing[playerid]=1;
}
else
{
SendClientMessage(playerid,COLOR_ERROR,"You Can Only Fish in Sea Vehicles.");
}
return 1;
}
forward Fish_Timer(playerid);
public Fish_Timer(playerid)
{
new string[1280];
new Weight = random(100 - 1) + 100;
switch(random(20))
{
case 0, 1, 2, 3, 4:
{
PlayerInfo[playerid][pFishes]+=1;
Fishing[playerid]=0;
FishWeight[playerid]+=Weight;
format(string, sizeof(string),"~w~Your Catch: ~p~%d lb %s",FishWeight[playerid],FishNames[PlayerInfo[playerid][pFishes]]);
GameTextForPlayer(playerid,string, 5000, 3);
format(string, sizeof(string), "You Have Caught %d lb %s.",FishWeight[playerid], FishNames[PlayerInfo[playerid][pFishes]]);
SendClientMessage(playerid, COLOR_CYAN, string);
}
case 5, 6, 7:
{
format(string, sizeof(string), "~w~Your Catch:~r~ None");
GameTextForPlayer(playerid,string, 5000, 3);
format(string, sizeof(string), "Failed To Catch Anything.");
SendClientMessage(playerid, COLOR_CYAN, string);
Fishing[playerid]=0;
}
case 8, 9:
{
GivePlayerMoney(playerid, 25000);
format(string, sizeof(string),"~w~Found:~p~ Nemo");
GameTextForPlayer(playerid,string, 5000, 3);
format(string, sizeof(string), "Recieved $25000 in Nemo.");
SendClientMessage(playerid, COLOR_CYAN, string);
Fishing[playerid]=0;
}
case 10:
{
GivePlayerMoney(playerid, 50000);
format(string, sizeof(string),"~w~Found:~g~ Money");
GameTextForPlayer(playerid,string, 5000, 3);
format(string, sizeof(string), "Recieved $50000");
SendClientMessage(playerid, COLOR_CYAN, string);
Fishing[playerid]=0;
}
case 11, 12:
{
format(string, sizeof(string),"~w~Found:~r~ Jimmy Hoffa");
GameTextForPlayer(playerid,string, 5000, 3);
format(string, sizeof(string), "Found a Dead Body. Throw it Back and keep Your Mouth Shut. ");
SendClientMessage(playerid, COLOR_CYAN, string);
Fishing[playerid]=0;
}
case 13, 14:
{
format(string, sizeof(string),"~w~Found: Used Condom");
GameTextForPlayer(playerid,string, 5000, 3);
format(string, sizeof(string), "Found Used Condom. Served With Fried Rice. ");
SendClientMessage(playerid, COLOR_CYAN, string);
Fishing[playerid]=0;
}
case 15, 16:
{
format(string, sizeof(string),"~w~Found: ~p~Underwear");
GameTextForPlayer(playerid,string, 5000, 3);
format(string, sizeof(string), "Found Underwear. You've Threw it Back Size Mismatch.");
SendClientMessage(playerid, COLOR_CYAN, string);
Fishing[playerid]=0;
}
case 17, 18, 19:
{
PlayerInfo[playerid][pFishes]+=1;
Fishing[playerid]=0;
FishWeight[playerid]+=Weight;
format(string, sizeof(string),"~w~Your Catch: ~p~%d lb %s",FishWeight[playerid],FishNames[PlayerInfo[playerid][pFishes]]);
GameTextForPlayer(playerid,string, 5000, 3);
format(string, sizeof(string), "You Have Caught %d lb %s.",FishWeight[playerid], FishNames[PlayerInfo[playerid][pFishes]]);
SendClientMessage(playerid, COLOR_CYAN, string);
}
}
return 1;
}