How to make a Ban/PM command.. -
CSMajor - 16.08.2010
well i tried making the /pm command but with my script it showed nothing to the other player.
So how could i make a /pm? do i use strtok? how can i also make a Ban command using BanEx(giveplayerid,reason);
how could i make the reason part work? idk how to do that......
Re: How to make a Ban/PM command.. -
Mike Garber - 16.08.2010
Just take one from any gamemode released on the forums...
Re: How to make a Ban/PM command.. -
gamer931215 - 16.08.2010
pawn Код:
if (IsPlayerAdmin(playerid))
{
if (!strcmp("/ban",cmd,true,5)) {
new tmp[128],id;
tmp=strtok(cmdtext,index);
id=strval(tmp);
if(!strlen(tmp) || !strlen(cmdtext[strlen(cmd)+strlen(tmp)+2]) || !IsNumeric(tmp)) {
return SendClientMessage(playerid,COLOR_GREEN,"USAGE: /ban [playerid] [Reason]");
}
else if(!IsPlayerConnected(id)) {
return SendClientMessage(playerid,COLOR_GREEN,"The Player is not connected");
}
else {
new pName[32];
new vName[32];
GetPlayerName(playerid,pName,32);
GetPlayerName(id,vName,32);
format(string,sizeof string,"Administrator: %s banned %s(%i%). Reason: %s.",pName,vName,id,cmdtext[strlen(cmd)+strlen(tmp)+2]);
SendClientMessageToAll(COLOR_GRAY,string);
Ban(id);
}
return 1;
}
(from my admin script)
For the PM look in the normal included base.pwn, i thaight it was there too.
Re: How to make a Ban/PM command.. -
akis_tze - 16.08.2010
the filterscript "base" have this commands /pm /kick /ban
Re: How to make a Ban/PM command.. -
rbN. - 16.08.2010
pawn Код:
if(!strcmp("/pm", cmdtext, true))
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,0xFF0000FF,"USAGE: /PM (id) (message)");
new id = strval(tmp);
gMessage = strrest(cmdtext,idx);
if(!strlen(gMessage)) return SendClientMessage(playerid,0xFF0000FF,"Usage: /pm (id) (message)");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"/pm :Invalid ID");
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pName,sizeof(pName));
format(Message,sizeof(Message),">> %s(%i): %s",iName,id,gMessage);
SendClientMessage(playerid,0xFFD720FF,Message);
format(Message,sizeof(Message),"** %s(%i): %s",pName,playerid,gMessage);
SendClientMessage(id,0xFFD720FF,Message);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
return 1;
}
Re: How to make a Ban/PM command.. -
xZacharias - 16.08.2010
Код:
C:\SAMP Server\gamemodes\shit.pwn(831) : error 017: undefined symbol "strrest"
C:\SAMP Server\gamemodes\shit.pwn(831) : error 033: array must be indexed (variable "gMessage")
ideas?
Re: How to make a Ban/PM command.. -
Vince - 16.08.2010
Try sscanf.
pawn Код:
dcmd_pm(playerid, params[])
{
new
target,
playername[24],
message[128],
string[128];
if(sscanf(params, "us", target, message))
return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /pm [Playerid/PartOfName] [Message]");
if(!IsPlayerConnected(target))
return SendClientMessage(playerid, COLOR_YELLOW, "Error: Invalid Playerid!");
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "(PM) %s (%d): %s", playername, playerid, message);
SendClientMessage(target, COLOR_YELLOW, string);
SendClientMessage(playerid, COLOR_YELLOW, "PM Sent.");
return 1;
}
Re: How to make a Ban/PM command.. -
xZacharias - 16.08.2010
Код:
C:\Users\New York City\Desktop\Desktop Dateien #3\LAdmin4v2\ladmin4v2.pwn(1189) : error 017: undefined symbol "sscanf"
wtf?
Re: How to make a Ban/PM command.. -
bigcomfycouch - 16.08.2010
download the sscanf plugin