Opis problema: Napravio sam komandu /megaphone i sve radi ali kako da stavim da samo kad je u vozilo da se moze koristit
Dio skripte:
if(strcmp(cmd, "/megaphone", true) == 0 || strcmp(cmd, "/m", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new tmpcar = GetPlayerVehicleID(playerid);
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext <= ' '))
{
idx++;
}
new offset = idx;
new result;
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext;
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: (/m)egaphone [megaphone chat]");
return 1;
}
if(gTeam == 2 || IsACop(playerid))
{
if(!IsACopCar(tmpcar))
{
if(PlayerInfo == 1 || PlayerInfo == 1 || PlayerInfo == 3 || PlayerInfo == 3)
{
new currank;
if(PlayerInfo == 1) { currank = "PD.Kadet"; }
else if(PlayerInfo == 2) { currank = "PD.Policajac"; }
else if(PlayerInfo == 3) { currank = "PD.Narednik"; }
else if(PlayerInfo == 4) { currank = "PD.Inspektor"; }
else if(PlayerInfo == 5) { currank = "PD.Porucnik"; }
else if(PlayerInfo == 6) { currank = "PD.Nacelnik "; }
else { currank = "PD.Kadet"; }
format(string, sizeof(string), "[%s %s:o< %s]", currank, sendername, result);
ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(PlayerInfo == 2||PlayerInfo == 2)
{
format(string, sizeof(string), "[Agent %s:o< %s]", sendername, result);
ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(PlayerInfo == 3||PlayerInfo == 3)
{
format(string, sizeof(string), "[Casnik %s:o< %s]", sendername, result);
ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
printf("%s", string);
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " Niste u policajskom vozilu!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "Niste clan Tima!");
return 1;
}
}
return 1;
}Slika/Video: //
