2 functions in a call back? >_< - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 2 functions in a call back? >_< (
/showthread.php?tid=96980)
2 functions in a call back? >_< -
_Vortex - 11.09.2009
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))
Re: 2 functions in a call back? >_< -
Kyosaur - 12.09.2009
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)
Re: 2 functions in a call back? >_< -
_Vortex - 12.09.2009
Thanks I'll try it.
Re: 2 functions in a call back? >_< -
ilikepie2221 - 12.09.2009
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.