22.10.2009, 13:19
Hello,
I have a question on return 1 or not.
I often see a SetTimer with and without return.
For example, Production is a SetTimer. If I puts return 1 in the end, it's identical if I puts nothing? And with CheckGas.
for(new i=0;i<MAX_PLAYERS;i++) return 1 or nothing.
Thanks.
I have a question on return 1 or not.
I often see a SetTimer with and without return.
For example, Production is a SetTimer. If I puts return 1 in the end, it's identical if I puts nothing? And with CheckGas.
Код:
public Production() { new string[256]; for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(PlayerInfo[i][pFishes] >= 5) { if(FishCount[i] >= 3) { PlayerInfo[i][pFishes] = 0; } else { FishCount[i] += 1; } } if(PlayerDrunk[i] > 0) { PlayerDrunk[i] = 0; PlayerDrunkTime[i] = 0; GameTextForPlayer(i, "~p~Drunk effect~n~~w~Gone", 3500, 1); } if(PlayerInfo[i][pPayDay] < 6) { PlayerInfo[i][pPayDay] += 1; } //+ 5 min to PayDay anti-abuse for(new k = 0; k < MAX_PLAYERS; k++) { if(IsPlayerConnected(k)) { if(gTeam[k] == 2 && CrimInRange(80.0, i,k)) { } else { WantedPoints[i] -= 3; if(WantedPoints[i] < 0) { WantedPoints[i] = 0; } new points = WantedPoints[i]; new wlevel; if(points > 0) { new yesno; if(points == 3) { if(WantedLevel[i] != 1) { WantedLevel[i] = 1; wlevel = 1; yesno = 1; } } else if(points >= 4 && points <= 5) { if(WantedLevel[i] != 2) { WantedLevel[i] = 2; wlevel = 2; yesno = 1; } } else if(points >= 6 && points <= 7) { if(WantedLevel[i] != 3) { WantedLevel[i] = 3; wlevel = 3; yesno = 1; } } else if(points >= 8 && points <= 9) { if(WantedLevel[i] != 4) { WantedLevel[i] = 4; wlevel = 4; yesno = 1; } } else if(points >= 10 && points <= 11) { if(WantedLevel[i] != 5) { WantedLevel[i] = 5; wlevel = 5; yesno = 1; } } else if(points >= 12 && points <= 13) { if(WantedLevel[i] != 6) { WantedLevel[i] = 6; wlevel = 6; yesno = 1; } } else if(points >= 14) { if(WantedLevel[i] != 10) { WantedLevel[i] = 10; wlevel = 10; yesno = 1; } } else if(points <= 0) { if(WantedLevel[i] != 0) { ClearCrime(i); WantedLevel[i] = 0; wlevel = 0; yesno = 1;} } if(yesno) { format(string, sizeof(string), "Current Wanted Level: %d", wlevel); SendClientMessage(i, COLOR_YELLOW, string); } } } } } } } }
Код:
public CheckGas() { new string[256]; for(new i=0;i<MAX_PLAYERS;i++) { if(IsPlayerConnected(i)) { if(GetPlayerState(i) == PLAYER_STATE_DRIVER) { new vehicle = GetPlayerVehicleID(i); if(Gas[vehicle] >= 1) { if(Gas[vehicle] <= 10) { PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0); } if(gGas[i] == 1) { format(string, sizeof(string), "~r~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ %d%",Gas[vehicle]); GameTextForPlayer(i,string,15500,3); } if(IsAPlane(vehicle) || IsABoat(vehicle)) { Gas[vehicle]++; } Gas[vehicle]--; } else { NoFuel[i] = 1; TogglePlayerControllable(i, 0); GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle~n~Use /exit to leave the vehicle",1500,3); } } } } return 1; }
Thanks.