26.10.2011, 11:14
I have a speedboost command with numbers. /ssb 1-3
1 = Off
2 = Medium
3 = High
Can I change it to Dialogs. I tried but it didn't work.
Here the command with numbers
Here is the command I tried
Is anything wrong and thats why it doesn't work.
1 = Off
2 = Medium
3 = High
Can I change it to Dialogs. I tried but it didn't work.
Here the command with numbers
pawn Код:
if (strcmp(cmd, "/SpeedBoostSetup", true) == 0 || strcmp(cmd, "/ssb", true) == 0)
{
new strBoostMultiplier[256];
new strTempString[256];
strBoostMultiplier = strtok(cmdtext, idx);
if (!strlen(strBoostMultiplier))
{
return 1;
}
if (!IsNumeric2(strBoostMultiplier))
{
return 1;
}
new Float:BoostMultiplier = floatstr(strBoostMultiplier);
if (BoostMultiplier < 1.0 || BoostMultiplier > 3.0)
{
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "*** Error: You can just change it for 0.1 to 3.0");
return 1;
}
SpeedBoostMultiplier[playerid] = BoostMultiplier;
format(strTempString,sizeof(strTempString), "*** You set your speed boost multiplier to %0.2f", SpeedBoostMultiplier[playerid]);
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, strTempString);
return 1;
}
pawn Код:
if (strcmp(cmdtext, "/tsb", true, 10) == 0) {
ShowPlayerDialog(playerid, 15, DIALOG_STYLE_LIST, "{FFFFFF}Toggle SpeedBoost", "Off\nMedium\nHigh", "Select", "Cancel");
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 15) {
if(response) {
if(listitem == 0) {
SpeedBoostMultiplier[playerid] = 1.0;
SendClientMessage(playerid, COLOR_ORANGE, "SpeedBoost is now Off");
}
if(listitem == 1) {
SpeedBoostMultiplier[playerid] = 2.0;
SendClientMessage(playerid, COLOR_ORANGE, "Speedboost changed to medium");
}
if(listitem == 2) {
SpeedBoostMultiplier[playerid] = 3.0;
SendClientMessage(playerid, COLOR_ORANGE, "Speedboost changed to high");
}
}
return 1;
}
return 0;
}