2 functions in a call back? >_<
#1

Ok, I'm really confused now. How do i add 2 or more functions in a call back. For instance,

Код:
public OnPlayerUpdate(playerid)
//kicks for high ping.
{
	new string[128];
	new pName[16];
	GetPlayerName(playerid, pName, sizeof(pName));
	if(GetPlayerPing(playerid) >= 750)
	{
		format(string, sizeof(string), "SERVER: %s has been kicked for high ping (max 750)", pName);
		SendClientMessageToAll(COLOR_RED, string);
	  SendClientMessage(playerid, COLOR_RED, "SERVER: You have been kicked for high ping.");
	  Kick(playerid);
	}
	return 1;
}
lets say I want to add a thing to disarm someone if they get a minigun or any other weapon, how would I add that to an existing code? (I'm not asking for a code to kick for miniguns, I'm asking how to add 2 or more functions in a call back (for the people who misread stuff))
Reply
#2

Quote:
Originally Posted by [B
Vortex ]
Ok, I'm really confused now. How do i add 2 or more functions in a call back. For instance,
... You just add the functions/if statements before the "return 1;" (btw: i'd move those arrays to the top of the script / put that GetPlayerName function inside your if statement)
Reply
#3

Thanks I'll try it.
Reply
#4

pawn Код:
SomeCallback()
{
  if(pie == 1)
  {
    // some function done if pie is equal to 1
  }
  else if(pie == 2)
  {
    // some function done if pie is equal to 2
  }
  return 1;
}
That's a basic framework. Try to modify it to your needs, :P.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)