Giveperm to ID
#1

hi all,
i have a question,
how can i create a function

e.x
/giveperm [PLAYERID]

that the entered player ID gets a input dialog for changing his/her nickname?

Sorry for my bad english im Dutch

-Luckie12
Reply
#2

some one?
Reply
#3

pawn Код:
dcmd_giveperm(playerid, params[])
{
  new targetid;
  if(!IsPlayerAdmin(playerid)) return 0;
  if(sscanf(params, "i", targetid)) return SendClientMessage(playerid, color, "Usage: /giveperm <id>");
  ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Change your name..", "Input your desired name into the box and press \"Submit\". \nIf you wish to cancel, select \"Cancel\".");
  return 1;
}
Reply
#4

Quote:
Originally Posted by Grim_
pawn Код:
dcmd_giveperm(playerid, params[])
{
 new targetid;
 if(!IsPlayerAdmin(playerid)) return 0;
 if(sscanf(params, "i", targetid)) return SendClientMessage(playerid, color, "Usage: /giveperm <id>");
 ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Change your name..", "Input your desired name into the box and press \"Submit\". \nIf you wish to cancel, select \"Cancel\".");
 return 1;
}
pawn Код:
C:\Documents and Settings\***\Bureaublad\pwn\filterscripts\Aprerm.pwn(43) : error 010: invalid function or declaration
C:\Documents and Settings\***\Bureaublad\pwn\filterscripts\Aprerm.pwn(43) : error 010: invalid function or declaration
C:\Documents and Settings\***\Bureaublad\pwn\filterscripts\Aprerm.pwn(43 -- 46) : error 010: invalid function or declaration
C:\Documents and Settings\***\Bureaublad\pwn\filterscripts\Aprerm.pwn(43 -- 46) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
line 43
pawn Код:
dcmd_giveperm(playerid, params[])
Reply
#5

Do you have dcmd in your script? If not, add it.
Reply
#6

Quote:
Originally Posted by Grim_
Do you have dcmd in your script? If not, add it.
lol im really stupid, what u mean with "Do you have a dcmd in your script? If not, add it"
how to add it?

sorry for this stupid question xD
Reply
#7

Add this:
pawn Код:
//After the #includes
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

//Onplayercommandtext
dcmd(giveperm,8,cmdtext);

//and then the cmd at the bottom of your script
Reply
#8

Or you can use this in OnPlayerCommandText (Requires strtok..)
pawn Код:
// Put this under OnPlayerCommandText
new cmd[256], tmp[256], idx;
cmd = strtok(cmdtext, idx);

if(strcmp(cmd, "/giveperm", true) == 0)
{
  if(!IsPlayerAdmin(playerid)) return 1;
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) return SendClientMessage(playerid, color, "Usage: /giveperm <id>");
  new targetid = strval(tmp);
  if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, color, "Error: Invalid playerid.");
  ShowPlayerDialog(targetid, 1, DIALOG_STYLE_INPUT, "Select a name..", "Input your desired name into the box and press \"Submit\". \nIf you wish to cancel, select \"Cancel\".");
  return 1;
}
Reply
#9

https://sampwiki.blast.hk/wiki/Fast_Commands
Reply
#10

Quote:
Originally Posted by Grim_
Or you can use this in OnPlayerCommandText (Requires strtok..)
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
// Put this under OnPlayerCommandText
new cmd[256], tmp[256], idx;
cmd = strtok(cmdtext, idx);

if(strcmp(cmd, "/giveperm", true) == 0)
{
  if(!IsPlayerAdmin(playerid)) return 1;
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) return SendClientMessage(playerid, color, "Usage: /giveperm <id>");
  new targetid = strval(tmp);
  if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, color, "Error: Invalid playerid.");
  ShowPlayerDialog(targetid, 1, DIALOG_STYLE_INPUT, "Select a name..", "Input your desired name into the box and press \"Submit\". \nIf you wish to cancel, select \"Cancel\".");
  return 1;
}
this crashes my compiler/server

and the one from Fj0rtizFredde

gives me 4 errors

pawn Код:
C:\Documents and Settings\Luc\Bureaublad\pwn\filterscripts\Aprerm.pwn(44) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Luc\Bureaublad\pwn\filterscripts\Aprerm.pwn(44) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Luc\Bureaublad\pwn\filterscripts\Aprerm.pwn(48) : error 010: invalid function or declaration
C:\Documents and Settings\Luc\Bureaublad\pwn\filterscripts\Aprerm.pwn(48) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Luc\Bureaublad\pwn\filterscripts\Aprerm.pwn(48) : error 010: invalid function or declaration
C:\Documents and Settings\Luc\Bureaublad\pwn\filterscripts\Aprerm.pwn(48 -- 51) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)