Textdraw Problem...
#1

I am using drug system for my gamemode, but I have one problem... Every time player connect to server, he will see textdraw.. I want player only to see textdraw when he use /usedrugs...
Here is code...
PHP код:
new TextDrugText;
new 
AllColors[10][1] = {
{
0xFFFF00AA},
{
0xFF0000AA},
{
0x0000FFAA},
{
0xFF8C00AA},
{
0x228B22AA},
{
0xFF4500AA},
{
0x8B4513AA},
{
0x708090AA},
{
0xFF6347AA},
{
0xEE82EEAA}
};
new 
DrugEffectTimer[MAX_PLAYERS];
forward DrugColorChange(playerid);
forward DrugOnGameModeInit();
forward DrugOnGameModeExit(playerid);
forward DrugOnPlayerDisconnect(playerid,reason);
public 
DrugOnGameModeInit()
{
    
DrugText TextDrawCreate(642.0000002.000000"New Textdraw");
    
TextDrawBackgroundColor(DrugText255);
    
TextDrawFont(DrugText1);
    
TextDrawLetterSize(DrugText1.00000026.800003);
    
TextDrawSetOutline(DrugText0);
    
TextDrawSetProportional(DrugText1);
    
TextDrawSetShadow(DrugText1);
    
TextDrawUseBox(DrugText1);
    
TextDrawBoxColor(DrugText503316610);
    
TextDrawTextSize(DrugText, -2.0000000.000000);
    return 
1;
}
public 
DrugOnGameModeExit(playerid)
{
    
KillTimer(DrugEffectTimer[playerid]);
    
TextDrawHideForAll(DrugText);
    
TextDrawDestroy(DrugText);
    return 
1;
}
public 
DrugColorChange(playerid)
{
    new 
randomize=random(sizeof(AllColors));
    
TextDrawBoxColor(DrugTextAllColors[randomize][0]);
    
TextDrawShowForPlayer(playerid,DrugText);
    return 
1;
}
public 
DrugOnPlayerDisconnect(playerid,reason)
{
    
KillTimer(DrugEffectTimer[playerid]);
    return 
1;

PHP код:
public OnGameModeInit()
{
    
DrugOnGameModeInit();
        ... 
PHP код:
public OnPlayerDisconnect(playerid,reason)
{
DrugOnPlayerDisconnect(playerid,reason); 
This is showing when player spawn...


I don't know how to fix this...
Reply
#2

If you want to show this textdraw when player writes /usedrugs, then use TextDrawShowForPlayer function inside /usedrugs command, not when player spawns.
Reply
#3

But I didn't used it inside OnPlayerSpawn
Reply
#4

Then where do you use TextDrawShowForPlayer?
Reply
#5

Only at DrugColorChange... You have in code above...
And also at /usedrugs command
DrugEffectTimer[playerid] = SetTimerEx("DrugColorChange",100,true,"d",playerid );
Reply
#6

Why do you create DrugEffectTimer variable? Do you put that timer only in the /usedrugs command?
Show me your OnPlayerSpawn, OnPlayerConnect and your /usedrugs command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)