23.12.2015, 16:42
if he want to use integer he can use parameter named x_nr
if(x_nr == 1) --- radio 1
if(x_nr == 2) -- radio 2
No reason to string compare to convert the parametre from a string when you can set it as integer.
It is more simple like that i guess. Correct me if i am wrong please.
Now lets check what you ask about.
if(x_nr == 1) --- radio 1
if(x_nr == 2) -- radio 2
No reason to string compare to convert the parametre from a string when you can set it as integer.
PHP код:
YCMD:radio(playerid, params[], help) //Komanda za radio
{
#pragma unused help
new x_nr;
new hID;
hID = GetPlayerVehicleID(playerid);
if(IsPlayerConnected(playerid) && gPlayerLogged[playerid] == 0) return LOGINGRESKA
if(PlayerInfo[playerid][pSpawn] == 5) return AREAGRESKA
if(IsBike(hID)) return BIKEGRESKARADIO
if(IsPlayerInVehicle(playerid, hID))
{
if(sscanf(params, "d", x_nr)) return SCM(playerid, C_KORISTENJE, "[UPUTA]: /radio [0-20]");
if(x_nr == 0)
{
StopAudioStreamForPlayer(playerid);
PlayerRadio[playerid]=0;
new stringgh[512];
format(stringgh, sizeof(stringgh), "RADIO: ~w~%d", PlayerRadio[playerid]);
PlayerTextDrawSetString(playerid, Brzinomjer[4][playerid], stringgh);
}
else if(x_nr == 1)
{
PlayAudioStreamForPlayer(playerid, "http://80.237.157.49:8070/");
PlayerRadio[playerid]=1;
new stringgh[512];
format(stringgh, sizeof(stringgh), "RADIO: ~w~%d", PlayerRadio[playerid]);
PlayerTextDrawSetString(playerid, Brzinomjer[4][playerid], stringgh);
}
}
return 1;
}
Now lets check what you ask about.
