SA-MP Forums Archive
problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: problem (/showthread.php?tid=486782)



problem - MatriXgaMer - 10.01.2014

Hello i have this code

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success) {
    if (!success) {
        TextDrawShowForPlayer(playerid, Textdraw0);
        SetTimerEx("InvalidKomanda", 3000, true, "");
    }
    return 1;
}

forward InvalidKomanda();
public InvalidKomanda()
{
    TextDrawDestroy(Textdraw0);
}
And the TextDraw is showing when an player writes an invalid command(unknown) and afrer 3 seconds it disaper. that is not the problem but the problem is when i type again the invalid command(unknown) the text draw dosent show up

The TextDraw if needed:

pawn Код:
Textdraw0 = TextDrawCreate(252.000000, 337.000000, "KOMANDA KOJU STE UKUCALI NEPOSTOJI");
    TextDrawBackgroundColor(Textdraw0, 255);
    TextDrawFont(Textdraw0, 2);
    TextDrawLetterSize(Textdraw0, 0.320000, 1.200000);
    TextDrawColor(Textdraw0, -1);
    TextDrawSetOutline(Textdraw0, 0);
    TextDrawSetProportional(Textdraw0, 1);
    TextDrawSetShadow(Textdraw0, 1);
    TextDrawUseBox(Textdraw0, 1);
    TextDrawBoxColor(Textdraw0, 1679040075);
    TextDrawTextSize(Textdraw0, 517.000000, 0.000000);



Re: problem - Miguel - 10.01.2014

It doesn't show up because you're destroying it after it's shown the first time. Don't destroy it but hide it instead.

https://sampwiki.blast.hk/wiki/TextDrawHideForPlayer

P.D: you'll have to pass playerid as an argument at SetTimerEx to know whose textdraw's going to be hidden.


Re: problem - MatriXgaMer - 10.01.2014

Quote:
Originally Posted by Miguel
Посмотреть сообщение
It doesn't show up because you're destroying it after it's shown the first time. Don't destroy it but hide it instead.

https://sampwiki.blast.hk/wiki/TextDrawHideForPlayer

P.D: you'll have to pass playerid as an argument at SetTimerEx to know whose textdraw's going to be hidden.
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success) {
    if (!success) {
        TextDrawShowForPlayer(playerid, Textdraw0);
        SetTimerEx("InvalidKomanda", 3000, false, "");
    }
    return 1;
}

forward InvalidKomanda();
public InvalidKomanda()
{
    TextDrawHideForPlayer(MAX_PLAYERS, Textdraw0);
}
I was thinking to replace playerid with MAX_PLAYERS because i get an error but not its not hiding the textdraw


Re: problem - IceShock - 10.01.2014

Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success) {
    if (!success) {
        TextDrawShowForPlayer(playerid, Textdraw0);
        SetTimerEx("InvalidKomanda", 3000, true, "");
		TextDrawHideForPlayer(playerid, Textdraw0);
    }
    return 1;
}
I hope I helped you.


Re: problem - amirab - 10.01.2014

Quote:
Originally Posted by IceShock
Посмотреть сообщение
Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success) {
    if (!success) {
        TextDrawShowForPlayer(playerid, Textdraw0);
        SetTimerEx("InvalidKomanda", 3000, true, "");
		TextDrawHideForPlayer(playerid, Textdraw0);
    }
    return 1;
}
I hope I helped you.
This Is WRONG!! you can't use this maybe it will crash the server

MatriXgaMer
you can use this one :
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success) {
    if (!
success) {
        
TextDrawShowForPlayer(playeridTextdraw0);
        
SetTimerEx("InvalidKomanda"5000false"i"playerid);
    }
    return 
1;
}
forward InvalidKomanda(playerid);
public 
InvalidKomanda(playerid)
{
    
TextDrawHideForPlayer(playeridTextdraw0);




Re: problem - MatriXgaMer - 10.01.2014

Quote:
Originally Posted by amirab
Посмотреть сообщение
you can use this one :
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success) {
    if (!
success) {
        
TextDrawShowForPlayer(playeridTextdraw0);
        
SetTimerEx("InvalidKomanda"5000false"i"playerid);
    }
    return 
1;
}
forward InvalidKomanda(playerid);
public 
InvalidKomanda(playerid)
{
    
TextDrawHideForPlayer(playeridTextdraw0);

Thanks REP+