Quote:
Originally Posted by Nero_3D
pawn Код:
//Somewhere outside CMD:pm(playerid, cmdtext[]) { new idx = strfind(cmdtext, " ", true); if((cmdtext[0] == EOS) || ((cmdtext[0] == '\1') && (cmdtext[1] == EOS)) || (idx == -1)) { SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)"); return 1; } if(cmdtext[idx + 1] == EOS) { SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)"); return 1; } cmdtext[idx++] = EOS; new id = strval(cmdtext); if(!IsPlayerConnected(id)) { SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/pm : Bad player ID"); return 1; } if(playerid == id) { SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"You cannot PM yourself"); return 1; } new string[256]; GetPlayerName(id, string, MAX_PLAYER_NAME); format(string, sizeof string, "[PM] Message send to %s(%d): %s", string, id, cmdtext[idx]); SendClientMessage(playerid, PM_OUTGOING_COLOR, string);
GetPlayerName(playerid, string, MAX_PLAYER_NAME); format(string, sizeof string, "[PM] Message received from %s(%d): %s", string, playerid, cmdtext[idx]); GameTextForPlayer(id, "[PM] Message received !", 1250, 1); SendClientMessage(id, PM_INCOMING_COLOR, string); PlayerPlaySound(id, 1057, 0.0, 0.0, 0.0);
printf("PM: %s", cmdtext[idx]); return 1; }
|
Thanks !
But 1 another cmd: plz convert it again to ZCMD xD if i do it ... it don't work >_<
pawn Код:
if(strcmp("/heal", cmd, true) == 0)
{
if (gTeam[playerid] == MEDIC)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
return SendClientMessage(playerid,COLOR_LIGHTBLUE,"USAGE: /heal [id]");
}
new id = strval(tmp);
new pid = playerid;
if(!IsPlayerConnected(id))
{
return SendClientMessage(playerid,COLOR_GREY,"AdmCmd: This player is not online!");
}
new Float:X,Float:Y,Float:Z, string[128], name[MAX_PLAYER_NAME];
GetPlayerName(id,name,128);
GetPlayerPos(id,X,Y,Z);
if(IsPlayerInRangeOfPoint(playerid,3,X,Y,Z))
{
format(string,128,"[INFO] Medic %s[%d] has healed you!", name, pid);
SetPlayerHealth(id,100);
SendClientMessage(id,COLOR_GREY,string);
return 1;
}
else
{
SendClientMessage(playerid,COLOR_RED,"You're not near the player!");
}
}
else
{
SendClientMessage(playerid,COLOR_RED,"You're not a Medic!");
return 1;
}
}
Thanks