16.09.2011, 12:24
Ok so 1st i have a heal command from a gamemode that ALWAYS points to id 0 ,it looks like this ->
As i said,even if i use /heal 3 ,it still targets id 0 (even if i put a name,same thing) .
Then i have the /report command that has a weirder bug ,if i put /report 0 REASON ,it says id 48 aint connected (and if i put 3 instead of 0 ,it says id 51 not connected )
any idea with this pls ?
pawn Код:
dcmd_heal(playerid,params[])
{
new string[128];
new ID;
if(sscanf(params, "u", ID))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /heal (Player Name/ID)");
return 1;
}
new Float:phealth;
GetPlayerHealth(ID,phealth);
if(IsSpawned[playerid] != 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
return 1;
}
if(IsKidnapped[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You are kidnapped. You cannot use this command.");
return 1;
}
if(IsFrozen[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You have been frozen by a Server Administrator. You cannot use this command.");
return 1;
}
if(gTeam[playerid] != TEAM_MEDIC)
{
SendClientMessage(playerid,COLOR_ERROR,"You are unable to heal people. Only medics can do this.");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"The Player ID (%d) is not connected to the server. You cannot heal them.",ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(ID == playerid)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot heal yourself with this command. Try /healme");
return 1;
}
if(GetDistanceBetweenPlayers(playerid,ID) > 6)
{
format(string,sizeof(string),"%s(%d) is not close enough. Get closer to them before trying to heal them.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(CalledForMedic[ID] == 0)
{
format(string,sizeof(string),"%s(%d) has not called for a medic. Tell them to type /medic first.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(phealth == 100)
{
SendClientMessage(playerid,COLOR_ERROR,"Their health is already full. You don't need to heal them.");
return 1;
}
if(GetPlayerMoney(ID) < SkillPrice[playerid])
{
SendClientMessage(playerid,COLOR_ERROR,"That player does not have enough money on them to pay your price.");
return 1;
}
SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Healed_]]");
format(string,sizeof(string),"You have healed %s(%d) for a price of $%d. Make sure they are happy.",PlayerName(ID),ID,SkillPrice[playerid]);
SendClientMessage(playerid,COLOR_FORESTGREEN,string);
GivePlayerMoney(playerid,SkillPrice[playerid]);
SendClientMessage(ID,COLOR_DEADCONNECT,"[[_Healed_]]");
format(string,sizeof(string),"You have been healed by %s(%d) for a price of $%d.",PlayerName(playerid),playerid,SkillPrice[playerid]);
SendClientMessage(ID,COLOR_FORESTGREEN,string);
GivePlayerMoney(ID,-SkillPrice[playerid]);
SetPlayerHealth(ID,100);
CalledForMedic[ID] =0;
format(string,sizeof(string),"3[MEDIC ACTION] %s(%d) has restored %s(%d)'s health by using /heal.",PlayerName(playerid),playerid,PlayerName(ID),ID);
IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
return 1;
}
Then i have the /report command that has a weirder bug ,if i put /report 0 REASON ,it says id 48 aint connected (and if i put 3 instead of 0 ,it says id 51 not connected )
pawn Код:
dcmd_report(playerid,params[])
{
new string[128];
new ID;
new cmdreason[100];
if(sscanf(params,"us[100]",ID,cmdreason))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /report (Player Name/ID) (Reason)");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"The Player ID (%d) is not connect to the server.",ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
format(string,sizeof(string),"[REPORT] You have successfully reported %s(%d) to the online Server Administrators.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ADMIN,string);
format(string,sizeof(string),"9[REPORT] Reporter: %s(%d) Reported: %s(%d) Reason: %s",PlayerName(playerid),playerid,PlayerName(ID),ID,cmdreason);
IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
format(string,sizeof(string),"[REPORT] Reporter: %s(%d) has reported %s(%d).",PlayerName(playerid),playerid,PlayerName(ID),ID);
SendClientMessageToAllAdmins(string);
format(string,sizeof(string),"[REPORT] Reason: %s.",cmdreason);
SendClientMessageToAllAdmins(string);
return 1;
}
any idea with this pls ?