Ayudenme porfavor :)
#1

Hola.
Bueno tengo otra duda.
Tengo esto:

Quote:

if(strcmp(cmd, "/suspect", true) == 0)
{
if(gTeam[playerid] == JOB_POLICE_OFFICER)
{
new tmp[256];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_YELLOW,"[ ! ] /suspect <playerid>");
new pid = strval(tmp);
if(!IsPlayerConnected(pid))
{
SendClientMessage(playerid, COLOR_RED,"[ ! ] This player is not connected");
}
if(GetPlayerWantedLevel(pid))
{
SendClientMessage(playerid, COLOR_RED,"[ ! ] This player is already suspected");
}
new string[256], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"(POLICE) %s has suspected you !",pName);
SendClientMessage(pid, COLOR_LIGHTBLUE, string);
SetPlayerWantedLevel(pid, 1);
}
else
{
SendClientMessage(playerid, COLOR_RED,"[ ! ] You are not in the Authorities team");
}
return 1;
}

Pero quiero que en /suspect <playerid> se pueda poner una rason.
Ejemplo: /suspect <playerid> <reason>

Reply
#2

pawn Код:
if(strcmp(cmd, "/suspect", true) == 0)
{
if(gTeam[playerid] == JOB_POLICE_OFFICER)
{
new tmp[256], tmp2[54];
tmp = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_YELLOW,"[ ! ] /suspect <playerid><reason>");
new pid = strval(tmp);
if(!IsPlayerConnected(pid))
{
SendClientMessage(playerid, COLOR_RED,"[ ! ] This player is not connected");
}
if(GetPlayerWantedLevel(pid))
{
SendClientMessage(playerid, COLOR_RED,"[ ! ] This player is already suspected");
}
new string[256], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"(POLICE) %s has suspected you!, reason: %s",pName,tmp2);
SendClientMessage(pid, COLOR_LIGHTBLUE, string);
SetPlayerWantedLevel(pid, 1);
}
else
{
SendClientMessage(playerid, COLOR_RED,"[ ! ] You are not in the Authorities team");
}
return 1;
}
Espero te sirva, Saludos!
Reply
#3

Si me sirvio.
Muchas gracias.
Reply
#4

De nada
Reply
#5

Podeis usar las balizas BBCODE [pawn ] y [/pawn ] sin los espaicios, para ver mejora el codigo
Reply
#6

Si queres tambiйn podes ponerle un:

pawn Код:
if(!strlen(tmp2)) return SendClientMessage(playerid, COLOR_YELLOW,"[ ! ] /suspect <playerid> <reason>");
Por si no, si no pone la razуn no le darб el mensaje de error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)