TextDrawiga kellaaeg/kuupäev
#1
Lisada scripti algusesse.
new Text:Time, TextBig Grinate;
forward settime(playerid);

Siis otsida üles ctrl+f = public OnFilterScriptInit()
selle alla panna selline kood:
Code:
SetTimer("settime",1000,true);

    Date = TextDrawCreate(542.000000,22.000000,"--");

    TextDrawFont(Date,3);
    TextDrawLetterSize(Date,0.399999,1.600000);
    TextDrawColor(Date,0xffffffff);

    Time = TextDrawCreate(542.000000,33.000000,"--");

    TextDrawFont(Time,3);
    TextDrawLetterSize(Time,0.399999,1.600000);
    TextDrawColor(Time,0xffffffff);
    return 1;
}

Siis jälle ctrl+f =public OnPlayerSpawn(playerid)
ja sinna alla panna:
Code:
TextDrawShowForPlayer(playerid, Time), TextDrawShowForPlayer(playerid,


Siis jälle ctrl+f =public OnPlayerDisconnect(playerid, reason)
ja sinna alla panna:
Code:
TextDrawHideForPlayer(playerid, Time), TextDrawHideForPlayer(playerid,

ja siis viimane asi panna scriptide lõppu selline asi!
Code:
public settime(playerid)
{
    new string[256],year,month,day,hours,minutes,seconds;
    getdate(year, month, day), gettime(hours, minutes, seconds);
    format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
    TextDrawSetString(Date, string);
    format(string, sizeof string, "%s%d:%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
    TextDrawSetString(Time, string);
}
Reply
#2
(23.12 2014, 01:20)Galaxu Wrote:  ja siis viimane asi panna scriptide lõppu selline asi!

Code:
public settime(playerid)
{
    new string[256],year,month,day,hours,minutes,seconds;
    getdate(year, month, day), gettime(hours, minutes, seconds);
    format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
    TextDrawSetString(Date, string);
    format(string, sizeof string, "%s%d:%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
    TextDrawSetString(Time, string);
}

Sellist lollust ei tohiks küll liikvele lasta.


Code:
public settime(playerid)
{
new string[256],year,month,day,hours,minutes,seconds;
getdate(year, month, day), gettime(hours, minutes, seconds);
format(string, sizeof string, "%d/%02d/%02d", day, month, year);
TextDrawSetString(Date, string);
format(string, sizeof string, "%02d:%02d:%02d", hours, minutes, seconds);
TextDrawSetString(Time, string);
}

Teiseks pole tegemist õpetusega, mitte midagi pole seletatud!

Edit: Miks on settime funktsioonil playerid parameeter, kui seda ei kasutata ei funktsioonis kui taimeri real? Tee enda õpetus korda või ma kustutan selle ära. Sama ka sinu teiste õpetuste kohta. Pole mõtet kopeerida siia SA:MP foorumi õpetust ning lisades sinna õpetussõnad "pane siia selline asi".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)