SA-MP Forums Archive
how can i define this - 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)
+--- Thread: how can i define this (/showthread.php?tid=643994)



how can i define this - RoyalEmpire - 01.11.2017

hey guys i need your help in this
how can i use this
return OnPlayerClickPlayer
how i can return this


Re: how can i define this - Abagail - 01.11.2017

You can simply use the return function if you want to get the return value or you can use CallLocalFunction to just call it.


Re: how can i define this - RoyalEmpire - 01.11.2017

Quote:
Originally Posted by Abagail
Посмотреть сообщение
You can simply use the return function if you want to get the return value or you can use CallLocalFunction to just call it.
can u give me example with onplayerclickplayer pls


Re: how can i define this - billy1337samp - 01.11.2017

Код:
public OnPlayerClickPlayer(playerid,clickerplayerid,source)
{
  return 1;
}



Re: how can i define this - RoyalEmpire - 01.11.2017

Quote:
Originally Posted by billy1337samp
Посмотреть сообщение
Код:
public OnPlayerClickPlayer(playerid,clickerplayerid,source)
{
  return 1;
}
how can i get this function with this if i want this in any dialog
return Onplayerclickplayer; not works


Re: how can i define this - Lucases - 02.11.2017

You mean calling "OnPlayerClickPlayer" callback inside a dialog?
I don't think that's possible because this callback gets called when someone clicks on a player in TAB


Re: how can i define this - Lokii - 02.11.2017

Quote:
Originally Posted by Lucases
Посмотреть сообщение
You mean calling "OnPlayerClickPlayer" callback inside a dialog?
I don't think that's possible because this callback gets called when someone clicks on a player in TAB
Actually it is possible but i dont see any reason to use this

PHP код:
#include <a_samp>
#include <izcmd>
IsNumeric(const string[])
{
    for(new 
0strlen(string); i++)
    {
        if(
string[i] < '0' || string[i] > '9') return 0;
    }
    return 
1;
}
CMD:clickp(playeridparams[])
{
    
ShowPlayerDialog(playerid0DIALOG_STYLE_INPUT"{FFFFFF}Click on player""{FFFFFF}Choose the id of the player that you want to click:""Click""Cancel");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
0:
        {
            switch(
response)
            {
                case 
1:
                {
                    if(!
IsNumeric(inputtext)) return ShowPlayerDialog(playerid0DIALOG_STYLE_INPUT"{FFFFFF}Click on player""{FFFFFF}Invalid number""Click""Cancel");
                    if(!
IsPlayerConnected(strval(inputtext))) return SendClientMessage(playerid0xFF0000FF"Invalid playerid");
                    
OnPlayerClickPlayer(playeridstrval(inputtext), -1);
                }
            }
        }
    }
    return 
0;
}
public 
OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    new 
name[24], name2[24], str[41], str2[40];
    
GetPlayerName(playeridnamesizeof(name));
    
GetPlayerName(clickedplayeridname2sizeof(name2));
    
format(strsizeof(str), "You clicked on: %s"name2);
    
format(str2sizeof(str2), "%s clicked on you"name);
    
SendClientMessage(playerid, -1str);
    
SendClientMessage(clickedplayerid, -1str2);
    return 
1;




Re: how can i define this - RoyalEmpire - 02.11.2017

thanks guys