28.04.2010, 02:04
So, im trying to create an accents section for my script. Im basicly done everything but I cant quite grasp the whole strval(tmp) stuff...
What Im trying to do is.. for example you type /accent 2 it would switch you to Italian (in my code) but it always goes to english... any help?
What Im trying to do is.. for example you type /accent 2 it would switch you to Italian (in my code) but it always goes to english... any help?
Код:
if(strcmp(cmd, "/accent", true) == 0) { new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[128]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /accent [accentid] (Type /accents for a list of accents)"); return 1; } new chooseaccent; chooseaccent = strval(tmp); if(chooseaccent == 0) { GameTextForPlayer(playerid, "Accent changed to English", 5000, 5); accent[playerid] = 0; return 1; } else if(chooseaccent == 1) { GameTextForPlayer(playerid, "Accent changed to Russian", 5000, 5); accent[playerid] = 1; return 1; } else if(chooseaccent == 2) { GameTextForPlayer(playerid, "Accent changed to Italian", 5000, 5); accent[playerid] = 2; return 1; } else if(chooseaccent == 3) { GameTextForPlayer(playerid, "Accent changed to Gangster", 5000, 5); accent[playerid] = 3; return 1; } else if(chooseaccent == 4) { GameTextForPlayer(playerid, "Accent changed to French", 5000, 5); accent[playerid] = 4; return 1; } else if(chooseaccent == 5) { GameTextForPlayer(playerid, "Accent changed to Japanese", 5000, 5); accent[playerid] = 5; return 1; } else if(chooseaccent == 6) { GameTextForPlayer(playerid, "Accent changed to Korean", 5000, 5); accent[playerid] = 6; return 1; } else if(chooseaccent == 7) { GameTextForPlayer(playerid, "Accent changed to Chinese", 5000, 5); accent[playerid] = 7; return 1; } else { SendClientMessage(playerid, COLOR_RED, "That isn't a valid accent ID!"); return 1; } }