Raised This Month: $32 Target: $400
 8% 

[ANY] playerpicker.inc


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
reBane
Senior Member
Join Date: May 2020
Old 03-07-2023 , 13:46   [ANY] playerpicker.inc
Reply With Quote #1

Hi, i wrote this inc file for targeted commands (/example @me). If the target is not found or no target was specified, this script can open a menu to the client, to pick a player from a list using PickPlayer().
There is an example in the gist, that might be outdated, but it should be a good reference.

Actual usage would be:
PHP Code:
void callback(int resultint userid) {
    
int client GetClientOfUserId(userid);
    if (!
client || !result) return; //result 0 = cancelled by user/menu timeout
    
if (result 0PrintToChat(client"Target error"); // <0 are target COMMAND_TARGET_* values
    
doWhatever(result); //result = client index
}
//...
    
PickPlayer(clientCOMMAND_FILTER_*, callbackGetClientUserId(client)); 
https://gist.github.com/DosMike/d8c3...09d845e113877a
__________________
Plugins & LibrariesListingGitHubDosMikeTools ▶ ToDo
reBane is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 03-08-2023 , 06:48   Re: [ANY] playerpicker.inc
Reply With Quote #2

Why don't you use this function?
int AddTargetsToMenu2(Handle menu, int source_client, int flags)
Attached Thumbnails
Click image for larger version

Name:	AddTargetsToMenu2.png
Views:	132
Size:	59.4 KB
ID:	199817  
__________________
Grey83 is offline
reBane
Senior Member
Join Date: May 2020
Old 03-08-2023 , 07:24   Re: [ANY] playerpicker.inc
Reply With Quote #3

There's a lot of natives, and sometimes I'll just spend some minutes writing a loop over spending some minutes of searching for the perfect native. Thanks for pointing that out, I'll update the gist when i get home
__________________
Plugins & LibrariesListingGitHubDosMikeTools ▶ ToDo
reBane is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode