Код:
if(strcmp(cmd, "/particular", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GREY, "Voce nгo e admin!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: (/par)ticular [ id ] [texto]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(HidePM[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, "O jogador bloqueor PMs!");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(giveplayerid == playerid)
{
format(string, sizeof(string), "* %s mutters somthing.", sendername);
ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: (/par)ticular [ id ] [whisper text]");
return 1;
}
format(string, sizeof(string), "%s(ID: %d) particular: %s", sendername, playerid, (result));
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
format(string, sizeof(string), "PM enviada para %s(ID: %d).", giveplayer, giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
SBizzInfo[2][sbTill] += SBizzInfo[2][sbEntranceCost] / 2;
ExtortionSBiz(2, SBizzInfo[2][sbEntranceCost] / 2);
return 1;
}
}
else
{
format(string, sizeof(string), " %d estб off-line.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
Usa strtok fi...
pawn Код:
if(strcmp(cmd,"/pm", true)==0)
{
new plid;
new texto;
new tmp[256];
tmp = strtok(cmdtext,idx);
plid = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COR, "Use: /pme [id] [texto]");
return 1;
}
texto=strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COR,"Use: /pme [id] [texto]");
return 1;
}
if(IsPlayerConnected(plid)==0)
{
SendClientMessage(playerid, COR, "Jogar nгo estб online");
return 1;
}
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "%s(ID: %d) particular: %s", pName, texto);
SendClientMessage(plid, COR, string);
return 1;
}