Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(cmdtext, "/getid", true, 6))
- {
- new
- foundNamesString[128];
- // Can't remember if this compiles in PAWN, might need to use format
- // new params[] = cmdtext[6];
- new params[128];
- format(params, sizeof(params), "%s", cmdtext[7]);
- if(!(3 < strlen(params) < MAX_PLAYER_NAME)) {
- SendClientMessage(playerid, -1,"Use /getid [name]. Search length must be greater than 3.");
- return 1;
- }
- SendClientMessage(playerid, -1, "Results:");
- for(new i = 0; i < 200; i++) {
- if(!IsPlayerConnected(i) || IsPlayerNPC(i)) {
- continue;
- }
- new name[24];
- GetPlayerName(i,name,24);
- if(strfind(params, name, true) == -1) {
- continue;
- }
- format(foundNamesString, sizeof(foundNamesString), "%s (ID:%i)",name, i);
- SendClientMessage(playerid, -1, foundNamesString);
- }
- if(!strlen(foundNamesString)) {
- SendClientMessage(playerid, -1, "No match found.");
- }
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment