What Is Wrong About This Code
I'm new at sourcepawn and general coding. I was trying to make a plugin that when someone type;
!slotol then it prints to all that "user(who typed !slotol) blablabla something". Here is my code Code:
#include <sourcemod> |
Re: What Is Wrong About This Code
PHP Code:
2. Please stick to using one syntax, preferably the new one. I updated it to this. 3. When using formatting of strings, you can use the format "%N" and then a client's index which will print the name of the client. 4. "%d" is for decimal values, not strings. 5. The reason "nothing happens" is because when you execute that command and it tries to format a string where a decimal is expected, you will get an error in the plugin. You should always check the server console. |
Re: What Is Wrong About This Code
You're also writing in the old Syntax, I'd recommend using
PHP Code:
|
Re: What Is Wrong About This Code
Quote:
I tried to use morecolors but it just prints numbers to chat. |
Re: What Is Wrong About This Code
iClient and Client are just variable names, doesn't really make a difference which you use but some people like to prefix their variable names with its data type to make code clearer.
e.g. int Args becomes iArgs char Letter becomes cLetter char[] Name becomes sName (for string, since char arrays are just strings) float Number becomes fNumber Again you don't have to do all this, but its a coding convention that makes code clearer and easier to read As for colours in CSGO you're more limited than other games with what you can use, but to add colour you just use these characters, and anything written after them will be that colour (got these from ColorVariables include) default (white): \x01 teamcolour (will be purple if message from server): \x03 red: \x07 lightred: \x0F darkred: \x02 bluegrey: \x0A blue: \x0B darkblue: \x0C purple: \x03 orchid: \x0E yellow: \x09 gold: \x10 lightgreen: \x05 green: \x04 lime: \x06 grey: \x08 grey2: \x0D Example: Say I want to make the word "red" red PrintToChatAll("This is the colour \x07red"); |
Re: What Is Wrong About This Code
Quote:
Thanks! |
Re: What Is Wrong About This Code
Quote:
|
Re: What Is Wrong About This Code
Quote:
PHP Code:
Quote:
e.g If you want green text: PHP Code:
|
Re: What Is Wrong About This Code
Quote:
|
Re: What Is Wrong About This Code
Quote:
CPrintToChatAll("{gold}blabla"); if you gtting error then you did something wrong |
All times are GMT -4. The time now is 17:06. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.