AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   PrintCenterText Not Work (https://forums.alliedmods.net/showthread.php?t=265803)

Unskilled 07-05-2015 10:33

PrintCenterText Not Work
 
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;
                    }
                }
            }
        } 


ecca 07-05-2015 11:06

Re: PrintCenterText Not Work
 
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.

Unskilled 07-05-2015 11:23

Re: PrintCenterText Not Work
 
it does not show me the text Print Center Text

KissLick 07-05-2015 13:13

Re: PrintCenterText Not Work
 
If you replace PrintCenterText with PrintToChat, does it work?

Unskilled 07-05-2015 13:40

Re: PrintCenterText Not Work
 
Not work with PrintToChat :/

ThatOneGuy 07-05-2015 13:57

Re: PrintCenterText Not Work
 
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.

KissLick 07-05-2015 14:01

Re: PrintCenterText Not Work
 
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

Darkness_ 07-05-2015 16:00

Re: PrintCenterText Not Work
 
-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.

Unskilled 07-05-2015 16:26

Re: PrintCenterText Not Work
 
In half life my code is work , in css not work :/


All times are GMT -4. The time now is 01:25.

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