how can you scan a variable and then apply it?
Hey dudes, I am trying to write a code that change the sv cheats as i wish.
i mean like, i am going to write /cheats 1 and sv_cheats will change to 1; so i try to scan from the user this info and then apply it into the code. what is the scanning function called? how to use it? i mean in C you just scanf("%+letter",&variable) also, i want this to print a fitting message to the client, if the variable = 1 to print in GREEN svcheats is *on* if the variable = 1 to print in RED svcheats is *off* i have 0 idea how i can scan from the user chat and apply it. any help? |
Re: how can you scan a variable and then apply it?
upd include
PHP Code:
|
Re: how can you scan a variable and then apply it?
Quote:
a few questions, is this the actual scan commnad? GetCmdArg(1, arg, sizeof(arg));? if so, what does the one means? i understood that args is a char array, and the sizeof(args) means the bytes (am i even right?), but what does the one means? when will args will be lower then one? when there is none? like cheats <nothing>? thanks! |
Re: how can you scan a variable and then apply it?
PHP Code:
|
Re: how can you scan a variable and then apply it?
Quote:
one last question, can you go a bit deeper about the first thing you need to input? GetCmdArg(1, arg, sizeof(arg)); this 1 means you can input only 0 and 1? or what? i am not fully get what this 1 stands for (as you may see its new for me). |
Re: how can you scan a variable and then apply it?
Arguement number to retrieve from the command.
|
Re: how can you scan a variable and then apply it?
argument number to retrieve.
for example we need to make a command like sm_cvar <cvar> <value> so need to do like this PHP Code:
|
Re: how can you scan a variable and then apply it?
Quote:
understood, Thanks. sorry to bother so much, But another last question. if i would like to use this number and do something with it? lets say i want to make a restart command and then enter seconds for it to wait before restart. so i did this far : Code:
public Action rr(int client, int args) |
Re: how can you scan a variable and then apply it?
PHP Code:
|
Re: how can you scan a variable and then apply it?
Quote:
char array in size of 4 means that it will contain 1 number? (integer byte size is 4)? how should i measure the array size? what 32 means? ofc its not 32 chars because that will be stupid. but what is it? |
All times are GMT -4. The time now is 10:13. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.