19.02.2011, 16:30
Try this :
pawn Код:
// Top of the ' OnPlayerCommandText ' callback.
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
// Under ' OnPlayerCommandText ' callback.
if(strcmp(cmd, "/changestation", true) == 0)
{
new station, tmp[128];
tmp = strtok(cmdtext, idx);
station = strval(tmp);
if(IsPlayerInAnyVehicle(playerid));
{
if(strlen(station))
{
if(IsNumeric(station))
{
if(station > 0 || station < 6) // Example: This makes you can choose between 1 - 5.
{
if(station == 1)
{
RadioChannel[vehicleid] = 1;
SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number one.");
return 1;
}
else if(station == 2)
{
RadioChannel[vehicleid] = 2;
SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number two.");
return 1;
}
else if(station == 3)
{
RadioChannel[vehicleid] = 3;
SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number three.");
return 1;
}
else if(station == 4)
{
RadioChannel[vehicleid] = 4;
SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number four.");
return 1;
}
else if(station == 5)
{
RadioChannel[vehicleid] = 5;
SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number five.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "Choose a station number from 1 to 5.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "Invalid station number.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "Type: /changestation [1 - 5]");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "You're not even in a vehicle.");
}
}