14.07.2012, 18:24
Just made it quickly.
pawn Код:
CMD:startlap(playerid,params[])
{
SetPVarInt(playerid,"lap",gettime()); //setting a var and stocking his value.
return 1;
}
CMD:finishlap(playerid,params[])
{
static string[50];
SetPVarInt(playerid,"totalseconds",gettime() - GetPVarInt(playerid,"lap")); // setting the var second + getting the actul time - var lap which is the time that started the lap.
SetPVarInt(playerid,"seconds",GetPVarInt(playerid,"totalseconds")% 60);// setting the var seconds
SetPVarInt(playerid,"minutes",(GetPVarInt(playerid,"totalseconds") - GetPVarInt(playerid,"seconds"))/60);//setting the var minutes, which is the total of seconds - seconds.
format(string,50,"You have finished in %i minutes and %i seconds",GetPVarInt(playerid,"minutes"),GetPVarInt(playerid,"seconds")); // formating the string
SendClientMessage(playerid,-1,string);//sending to the playerid.
return 1;
}