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

Solved Using a default prefix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
condolent
AlliedModders Donor
Join Date: Jan 2016
Location: gc_sLocation;
Old 06-09-2017 , 17:18   Using a default prefix
Reply With Quote #1

Hello,
I have this code:
PHP Code:
new String:prefix[] = "[{green}TrinityPlay{default}]";
public 
Action sm_spawnsleft(int clientint args) {
    
    
CPrintToChat(client"%p You have %d respawns left!"prefixRespawnLeft[client]);
    
    return 
Plugin_Handled;

But this just prints:
Code:
%p You have x respawns left!
I'm not really sure how the % works. Is there a specific character I'm supposed to use? For example, does P not work?
__________________

Last edited by condolent; 06-09-2017 at 17:31.
condolent is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 06-09-2017 , 17:23   Re: Using a default prefix
Reply With Quote #2

%p does not exist, to print string you need to use %s
PHP Code:
    CPrintToChat(client"%s You have %d respawns left!"prefixRespawnLeft[client]); 
Check this: https://wiki.alliedmods.net/Format_C...eMod_Scripting)
__________________


Max-Play.pl - the best polish servers

Last edited by CamerDisco; 06-09-2017 at 17:25.
CamerDisco is offline
condolent
AlliedModders Donor
Join Date: Jan 2016
Location: gc_sLocation;
Old 06-09-2017 , 17:24   Re: Using a default prefix
Reply With Quote #3

Quote:
Originally Posted by CamerDisco View Post
%p does not exist, to print string you need to use %s
PHP Code:
    CPrintToChat(client"%s You have %d respawns left!"prefixRespawnLeft[client]); 
I see, so S is always for Strings? I pressume D is for numbers??
__________________
condolent is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 06-09-2017 , 17:30   Re: Using a default prefix
Reply With Quote #4

Yes, read this what I sent: https://wiki.alliedmods.net/Format_C...eMod_Scripting
It depends on the type of variable.
__________________


Max-Play.pl - the best polish servers
CamerDisco is offline
condolent
AlliedModders Donor
Join Date: Jan 2016
Location: gc_sLocation;
Old 06-09-2017 , 17:31   Re: Using a default prefix
Reply With Quote #5

Quote:
Originally Posted by CamerDisco View Post
Yes, read this what I sent: https://wiki.alliedmods.net/Format_C...eMod_Scripting
It depends on the type of variable.
Thank you, exactly what I needed! Will do some reading on this
__________________
condolent is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 06-09-2017 , 18:03   Re: Using a default prefix
Reply With Quote #6

Or you can use ColorVariables and then just do
PHP Code:
CSetPrefix("TrinityPlay"); 
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.
KissLick is offline
Reply



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 03:03.


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