/heal playerid
#1

Код:
dcmd_heal(playerid,params[])
{
  new PlayerName[MAX_PLAYER_NAME];
  new Float:tmp3;
	new Float:px, Float:py, Float:pz;
	new string[128];
	new giveplayerid;
	new idx,tmpit[256];
	tmpit = strtok(params,idx);
 	giveplayerid = ReturnUser(tmpit);
	GetPlayerPos(giveplayerid,px,py,pz);
  if(sscanf(params,"i",strval(params))) SendClientMessage(playerid,COLOR_RED,"Usage: /heal <playerid>");
  if(!PlayerToPoint(3.0,playerid,px,py,pz)) return SendClientMessage(playerid, COLOR_RED, "You are not close enough!");
  if(PlayerInventoryPlayerHasItem(playerid,"Small HP Pack")) return SendClientMessage(playerid, COLOR_RED, "You Dont Have Medkit");
  {
  else // ERROR
  {
    if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid,COLOR_RED,"Error, player not found!");
    GetPlayerHealth(playerid,tmp3);
    SetPlayerHealth(playerid,tmp3+20);
    GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
    format(string,sizeof(string),"You have been healed by %s",PlayerName(strval(params))); //ERROR line 3614
    SendClientMessage(strval(params),COLOR_RED,string);
  }
  }
  return 1;
}
Код:

(3608) : error 029: invalid expression, assumed zero
(3614) : error 012: invalid function call, not a valid address
(3614) : error 001: expected token: ";", but found ")"
(3614) : error 029: invalid expression, assumed zero
(3614) : fatal error 107: too many error messages on one line
Commented where are errors.
Can someone help me fix these errors?
Reply
#2

Код:
format(string,sizeof(string),"You have been healed by %s",PlayerName(strval(params))); //ERROR line 3614
Should be

Код:
format(string,sizeof(string),"You have been healed by %s",PlayerName(strval(params)); //ERROR line 3614
Also, you used else without giving it anything to do, it should look like this (This is with both errors fixed)

Код:
dcmd_heal(playerid,params[])
{
  new PlayerName[MAX_PLAYER_NAME];
  new Float:tmp3;
	new Float:px, Float:py, Float:pz;
	new string[128];
	new giveplayerid;
	new idx,tmpit[256];
	tmpit = strtok(params,idx);
 	giveplayerid = ReturnUser(tmpit);
	GetPlayerPos(giveplayerid,px,py,pz);
  if(sscanf(params,"i",strval(params))) SendClientMessage(playerid,COLOR_RED,"Usage: /heal <playerid>");
  if(!PlayerToPoint(3.0,playerid,px,py,pz)) return SendClientMessage(playerid, COLOR_RED, "You are not close enough!");
  if(PlayerInventoryPlayerHasItem(playerid,"Small HP Pack"))
  {
    SendClientMessage(playerid, COLOR_RED, "You Dont Have Medkit");
    return 1;
	}
  if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid,COLOR_RED,"Error, player not found!");
  GetPlayerHealth(playerid,tmp3);
  SetPlayerHealth(playerid,tmp3+20);
  GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
  format(string,sizeof(string),"You have been healed by %s",PlayerName(strval(params)); //ERROR line 3614
  SendClientMessage(strval(params),COLOR_RED,string);
  return 1;
}
Reply
#3

Fixed the
Код:
else
error


but same error at line 3614 :/
Reply
#4

I suggest you to do
pawn Код:
format(string,sizeof string,"You have been healed by %s.",PlayerName(giveplayerid));
Reply
#5

Quote:
Originally Posted by revenngeR
Fixed the
Код:
else
error


but same error at line 3614 :/
Reply
#6

Quote:
Originally Posted by revenngeR
Quote:
Originally Posted by revenngeR
Fixed the
Код:
else
error


but same error at line 3614 :/
so show your line 3614,how we can answer you?!
Reply
#7

Quote:
Originally Posted by sandisk125
Quote:
Originally Posted by revenngeR
Quote:
Originally Posted by revenngeR
Fixed the
Код:
else
error


but same error at line 3614 :/
so show your line 3614,how we can answer you?!
i have commented it

Код:
dcmd_heal(playerid,params[])
{
  new PlayerName[MAX_PLAYER_NAME];
  new Float:tmp3;
	new Float:px, Float:py, Float:pz;
	new string[128];
	new giveplayerid;
	new idx,tmpit[256];
	tmpit = strtok(params,idx);
 	giveplayerid = ReturnUser(tmpit);
	GetPlayerPos(giveplayerid,px,py,pz);
  if(sscanf(params,"i",strval(params))) SendClientMessage(playerid,COLOR_RED,"Usage: /heal <playerid>");
  if(!PlayerToPoint(3.0,playerid,px,py,pz)) return SendClientMessage(playerid, COLOR_RED, "You are not close enough!");
  if(PlayerInventoryPlayerHasItem(playerid,"Small HP Pack"))
  {
    SendClientMessage(playerid, COLOR_RED, "You Dont Have Medkit");
    return 1;
	}
  if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid,COLOR_RED,"Error, player not found!");
  GetPlayerHealth(playerid,tmp3);
  SetPlayerHealth(playerid,tmp3+20);
  GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
  format(string,sizeof(string),"You have been healed by %s",PlayerName(strval(params)); //ERROR line 3615 same errors as before
  SendClientMessage(strval(params),COLOR_RED,string);
  return 1;
}
Reply
#8

You didn't fix the missed bracket.. add one more to strval(params[0])
Reply
#9

Quote:
Originally Posted by MenaceX^
You didn't fix the missed bracket.. add one more to strval(params[0])
now i only have

Код:
 error 012: invalid function call, not a valid address
Reply
#10

What line is the error on?You can find out by looking at the number before the error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)