05.05.2015, 04:35
Assuming garageid is an integer this:
would not work because strval is reading an int value out of a string (array) - which garageid just isn't.
A proper way would be getting the int value from the delimited cmdtext (strtok, dcmd) and put that value into the switch (so basically strval(cmd) instead of strval(garageid) - assuming strtok or dcmd and "cmd" containing the value as string).
Theoretically strfind does work for this too, just that it would detect "/checkgarageaddrandomtexthere" as "/checkgarage", since it contains "/checkgarage".
TiXz0r, look for command processors on the forums and maybe some tutorials, they explain the differences between the methods very well.
Код:
switch(strval(garageid)) { case 1://player have typed 1 { //your code } case 2://player have typed 2 { //your code } default://mkae use of this when the player have typed an invalid number }
A proper way would be getting the int value from the delimited cmdtext (strtok, dcmd) and put that value into the switch (so basically strval(cmd) instead of strval(garageid) - assuming strtok or dcmd and "cmd" containing the value as string).
Theoretically strfind does work for this too, just that it would detect "/checkgarageaddrandomtexthere" as "/checkgarage", since it contains "/checkgarage".
TiXz0r, look for command processors on the forums and maybe some tutorials, they explain the differences between the methods very well.