08.01.2015, 18:35
Scripted the missing things but still timer aint saving in user file but user file is being updated with info that i have added new timer.What could be the reason that it doesent save in user file after using the cmd?
So this is all what i have:
CMD itself:
So this is all what i have:
PHP код:
pFishingTime,
PlayerInfo[playerid][pFishingTime] = 0;
dini_IntSet(file, "FishingTime", PlayerInfo[playerid][pFishingTime]);
PlayerInfo[playerid][pFishingTime] = dini_Int(file, "FishingTime");
if(Fished[playerid] >= 5)
{
Fished[playerid] = 0;
FishTime[playerid] = 60*5;
SetTimerEx("FishingTime", 1000, false, "i", playerid);
}
return 1;
forward FishingTime(playerid);
public FishingTime(playerid)
{
FishTime[playerid] --;
if(FishTime[playerid] < 0)
{
FishTime[playerid] = 0;
}
if(FishTime[playerid] > 0)
{
SetTimerEx("FishingTime", 1000, false, "i", playerid);
}
return 1;
}
PHP код:
CMD:fish(playerid, params[])
{
new string[128], done, fish;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsPlayerNearWater(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not near water to catch fish.(You need to stand in water)");
if(FishTime[playerid])
{
format(string, sizeof(string), "You need to wait %d more seconds before fishing again.", FishTime[playerid]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
for(new i=0; i<5; i++) // Fish
{
if(!done)
{
if(!PlayerInfo[playerid][pFish][i]) done = i+1;
}
}
if(!done) return SendClientMessage(playerid, COLOR_GREY, "You can't carry anymore fishes.");
done = done-1;
// Catching
if(strval(RPJL(playerid, JOB_FISHER)) == 1) fish = random(25)+1;
else if(strval(RPJL(playerid, JOB_FISHER)) == 2) fish = random(26)+5;
else if(strval(RPJL(playerid, JOB_FISHER)) == 3) fish = random(31)+10;
else if(strval(RPJL(playerid, JOB_FISHER)) == 4) fish = random(36)+15;
else if(strval(RPJL(playerid, JOB_FISHER)) == 5) fish = random(41)+25;
PlayerInfo[playerid][pFish][done] = fish;
format(string, sizeof(string), "* %s attempts to catch a fish using the fishing rod.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
format(string, sizeof(string), " You have caught a %d lbs fish.", fish);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
// Leveling
new oldj = strval(RPJL(playerid, JOB_FISHER));
PlayerInfo[playerid][pJobSkill][JOB_FISHER] ++;
if(DayRespect == 1)
{
PlayerInfo[playerid][pJobSkill][JOB_FISHER] ++;
}
new newj = strval(RPJL(playerid, JOB_FISHER));
if(oldj < newj)
{
format(string, sizeof(string), "** Your Fisher level is now %d, you can now catch heavier fishes. **", newj);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
Fished[playerid] ++;
if(Fished[playerid] >= 5)
{
Fished[playerid] = 0;
FishTime[playerid] = 60*5;
SetTimerEx("FishingTime", 1000, false, "i", playerid);
}
return 1;
}