01.11.2017, 16:32
hey guys i need your help in this
how can i use this
return OnPlayerClickPlayer
how i can return this
how can i use this
return OnPlayerClickPlayer
how i can return this
public OnPlayerClickPlayer(playerid,clickerplayerid,source) { return 1; }
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 |
#include <a_samp>
#include <izcmd>
IsNumeric(const string[])
{
for(new i = 0; i < strlen(string); i++)
{
if(string[i] < '0' || string[i] > '9') return 0;
}
return 1;
}
CMD:clickp(playerid, params[])
{
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "{FFFFFF}Click on player", "{FFFFFF}Choose the id of the player that you want to click:", "Click", "Cancel");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 0:
{
switch(response)
{
case 1:
{
if(!IsNumeric(inputtext)) return ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "{FFFFFF}Click on player", "{FFFFFF}Invalid number", "Click", "Cancel");
if(!IsPlayerConnected(strval(inputtext))) return SendClientMessage(playerid, 0xFF0000FF, "Invalid playerid");
OnPlayerClickPlayer(playerid, strval(inputtext), -1);
}
}
}
}
return 0;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
new name[24], name2[24], str[41], str2[40];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(clickedplayerid, name2, sizeof(name2));
format(str, sizeof(str), "You clicked on: %s", name2);
format(str2, sizeof(str2), "%s clicked on you", name);
SendClientMessage(playerid, -1, str);
SendClientMessage(clickedplayerid, -1, str2);
return 1;
}