Raised This Month: $12 Target: $400
 3% 

PrintCenterText Not Work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unskilled
Junior Member
Join Date: Dec 2013
Old 07-05-2015 , 10:33   PrintCenterText Not Work
Reply With Quote #1

Hi guys

My printHintText not work why ?

Code :

PHP Code:
for(new 1<= GetMaxClients(); X++)
        {
            
//Drug Addict Plants Loop:
            
for(new 16D++)
            {
                
//X = 32 possible players
                //D = 5 possible plants
                //XOrigins = Player Origin
                //Looping through all players in this loop to see other drug origins!
                
                
if(DrugPlant[X][D][0] != 0.0)
                {
                    
TE_SetupBeamRingPoint(DrugPlant[X][D], 25.01.0g_modelLaserg_modelHalo0100.65.00.5, {255,0,0,255}, 100);
                    
TE_SendToClient(client);
                    
Distz GetVectorDistance(DrugPlant[X][D], ClientOrigin);
                    if(
Distz 50 && DrugPlant[X][D][0] != 0.0)
                    {
                        if(
client == X)
                        {
                            
PrintCenterText(client"Drug Plant (%d grams) Press E to take the drugs!"DrugPlantWorth[X][D]);
                        }
                        else
                        {
                            
decl String:Steal[64];
                            
GetClientName(XStealsizeof(Steal));
                            if(!
IsPolice(client))
                            {
                                
PrintCenterText(client"%s's Drug Plant (%d grams) Press E to steal the drugs!"StealDrugPlantWorth[X][D]);
                            }
                            else if(
IsPolice(client) || IsJustice(client))
                            {
                                
PrintCenterText(client"%s's Drug Plant (%d grams) Press E to destroy the drugs!"StealDrugPlantWorth[X][D]);
                            }
                        }
                    }
                    
                    
//Grams increasing randomly 5 percent of the time x32maxplayers:
                    
decl Randq;
                    
Randq GetRandomInt(1100);
                    if(
Randq 94 && DrugPlantWorth[X][D] < 300)
                    {
                        
DrugPlantWorth[X][D] += 1;
                    }
                }
            }
        } 
Unskilled is offline
ecca
Sexy Santa
Join Date: Jan 2011
Old 07-05-2015 , 11:06   Re: PrintCenterText Not Work
Reply With Quote #2

Well what doesn't work ? Printing it at all or something specifik? Does it return any errors..?

Also noticed you're using "client" when you have "X" from the loop.
__________________

Last edited by ecca; 07-05-2015 at 11:07.
ecca is offline
Unskilled
Junior Member
Join Date: Dec 2013
Old 07-05-2015 , 11:23   Re: PrintCenterText Not Work
Reply With Quote #3

it does not show me the text Print Center Text
Unskilled is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 07-05-2015 , 13:13   Re: PrintCenterText Not Work
Reply With Quote #4

If you replace PrintCenterText with PrintToChat, does it work?
KissLick is offline
Unskilled
Junior Member
Join Date: Dec 2013
Old 07-05-2015 , 13:40   Re: PrintCenterText Not Work
Reply With Quote #5

Not work with PrintToChat :/
Unskilled is offline
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 07-05-2015 , 13:57   Re: PrintCenterText Not Work
Reply With Quote #6

Try adding a check in your loop to make sure the clients being looped are valid (IsClientInGame). I'd imagine that youre getting an error in your error logs when trying to get the distance and/or name to invalid client slots.
__________________

Last edited by ThatOneGuy; 07-05-2015 at 13:57.
ThatOneGuy is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 07-05-2015 , 14:01   Re: PrintCenterText Not Work
Reply With Quote #7

Well if it's not working with neither PrintCenterText or PrintToChat, then you should review your code...
You got some semantic error there.

Hint: Check if you pass the ifs

P.S.: I believe, that GetMaxClients() should be MaxClients

Last edited by KissLick; 07-05-2015 at 14:02.
KissLick is offline
Darkness_
Veteran Member
Join Date: Nov 2014
Old 07-05-2015 , 16:00   Re: PrintCenterText Not Work
Reply With Quote #8

-Change your for loop to something like:
for (int X = 1; X <= MaxClients; X++)
-Check if the client is in game using IsClientInGame before doing anything in the loop.
-Don't use GetClientName if you are just using it in PrintToCenterText. Use %N formatter with the client's index.
Darkness_ is offline
Unskilled
Junior Member
Join Date: Dec 2013
Old 07-05-2015 , 16:26   Re: PrintCenterText Not Work
Reply With Quote #9

In half life my code is work , in css not work :/
Unskilled is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode