Quote:
Originally Posted by Dayrion
There is quick tutorial to explain when you can use the keyword stock: http://forum.sa-mp.com/showpost.php?...16&postcount=1
Now, you can learn something new. It's called "switch case" statement (« tutorial here!).
PHP код:
GetTruckNeedTracks(playerid)
{
new truckneedtracks;
new truckskill = GetPlayerTruckSkill(playerid);
if(truckskill == 1) truckneedtracks = 35;
else if(truckskill == 2) truckneedtracks = 100;
else if(truckskill == 3) truckneedtracks = 220;
else if(truckskill == 4) truckneedtracks = 450;
return truckneedtracks;
}
Become (with some tiny optimisations)
PHP код:
GetTruckNeedTracks(playerid)
{
switch(GetPlayerTruckSkill(playerid))
{
case 1: return 35;
case 2: return 100;
case 3: return 220;
case 4: return 450;
}
return 0;
}
|
Thanks you,i ll try using this method