#1

hello i have make this code and its work fine but even if im not rcon and do /heal i still get this message "Healing a specific player: /heal <playerid>"

Код:
CMD:heal(playerid,pramas[])
{
   new targetid;
   if(sscanf(pramas,"u", targetid)) return SCM(playerid, RED, "Healing a specific player: /heal <playerid>");
   if(!IsPlayerConnected(targetid)) return SCM(playerid, RED, "Player is not connected!");
   if(!IsPlayerAdmin( playerid ) )return SCM( playerid, RED, "Unknown Command! Type /help" );

   SetPlayerHealth(targetid, 100.0);

   new pName[MAX_PLAYER_NAME], h_msg[100];
   GetPlayerName(playerid, pName,sizeof (pName));
   format(h_msg,sizeof (h_msg),"Administrator %s healed you!",pName);
   SCM(playerid, RED, h_msg);
   return 1;
}
Reply
#2

pawn Код:
CMD:heal(playerid,pramas[])
{
   new targetid;
   if(!IsPlayerAdmin( playerid ) )return SCM( playerid, RED, "Unknown Command! Type /help" );
   if(sscanf(pramas,"u", targetid)) return SCM(playerid, RED, "Healing a specific player: /heal <playerid>");
   if(!IsPlayerConnected(targetid)) return SCM(playerid, RED, "Player is not connected!");

   SetPlayerHealth(targetid, 100.0);

   new pName[MAX_PLAYER_NAME], h_msg[100];
   GetPlayerName(playerid, pName,sizeof (pName));
   format(h_msg,sizeof (h_msg),"Administrator %s healed you!",pName);
   SCM(playerid, RED, h_msg);
   return 1;
}
Reply
#3

so the sscanf must be under IsPlayerAdmin?!
Reply
#4

pawn Код:
CMD:heal(playerid,params[])
{
    new id;
    if(!IsPlayerAdmin(playerid)) return SCM( playerid, RED, "Unknown Command! Type /help" );
    if(sscanf(params,"u",id)) return SCM(playerid, RED, "Healing a specific player: /heal <playerid>");
    if(!IsPlayerConnected(id)) return SCM(playerid, RED, "Player is not connected!");
       
    SetPlayerHealth(id,100);

    new pName[MAX_PLAYER_NAME], h_msg[100];
    GetPlayerName(playerid, pName,sizeof (pName));
    format(h_msg,sizeof (h_msg),"Administrator %s healed you!",pName);
    SCM(playerid, RED, h_msg);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)