TextDrawSetString
#1

Код:
so this cmd is soupposed to set the time in the MAP(NOT WORLD TIME) but it does not work
TextDrawSetString(TimeLeft,"time");<<u see the problem?
i tried this aswel
TextDrawSetString(TimeLeft,"%d",time);//did not work
so i need some help
Код:
entire cmd
CMD:settime(playerid,params[])
{
    new string[128];
	if(!Info[playerid][Logged]) return 0;
	if(Info[playerid][Level] < 2) return ERRORMSG(playerid);
	new time;
	if(sscanf(params,"d",time)) return SendClientMessage(playerid,COLOR_GREY,"HELP: /settime [time]");
	TextDrawHideForAll(TimeLeft);
	TextDrawSetString(TimeLeft,"time");
   	TextDrawShowForAll(TimeLeft);
	format(string,sizeof(string),"%s(%d) Has set the time or map to %d,",PlayerName(playerid), playerid, time);
	SendClientMessageToAll(COLOR_ADMIN,string);
	return 1;
}
Reply
#2

pawn Код:
CMD:settime(playerid,params[])
{
    new string[128];
    if(!Info[playerid][Logged]) return 0;
    if(Info[playerid][Level] < 2) return ERRORMSG(playerid);
    new time;
    if(sscanf(params,"d",time)) return SendClientMessage(playerid,COLOR_GREY,"HELP: /settime [time]");
    TextDrawHideForAll(TimeLeft);
    new _timeString[3]; format(_timeString, sizeof(_timeString), "%d", time);
    TextDrawSetString(TimeLeft,_timeString);
    TextDrawShowForAll(TimeLeft);
    SetWorldTime(time);
    format(string,sizeof(string),"%s(%d) Has set the time or map to %d,",PlayerName(playerid), playerid, time);
    SendClientMessageToAll(COLOR_ADMIN,string);
    return 1;
}
Try that.. You forgot a function. (https://sampwiki.blast.hk/wiki/SetWorldTime)
Reply
#3

i shall test, will edit when when i get back...
Reply
#4

im sorry but did u even read my post?
so this cmd is soupposed to set the time in the MAP(NOT WORLD TIME) but it does not work
TextDrawSetString(TimeLeft,"time");<<u see the problem?
i tried this aswel
TextDrawSetString(TimeLeft,"%d",time);//did not work
so i need some help
Reply
#5

Did you even read the code?

pawn Код:
new _timeString[3]; format(_timeString, sizeof(_timeString), "%d", time);
    TextDrawSetString(TimeLeft,_timeString);
It does set it.
Did you test it out?
Reply
#6

yes i tested it out, it's set's the world time instead...
Reply
#7

You can just remove this, "SetWorldTime(time);"

Do you use, new Text:TimeLeft; ?
Reply
#8

I fixed it thanks anyways
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)