Facepalm Command!? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Facepalm Command!? (
/showthread.php?tid=400470)
Facepalm Command!? -
martin3644 - 18.12.2012
Hello!
I wanna make a trolling command. Facepalm command!
It works so: /fp (id)
And it send a message to all; me facepalms towards (playername)
When you can help me, then help!
Thank You!
Re: Facepalm Command!? -
martin3644 - 18.12.2012
NoOne Know? I'm not very pro in scripting.
Sorry for bad English!
Re: Facepalm Command!? -
LetsOWN[PL] - 18.12.2012
Hello.
You need to have:
* zcmd
* sscanf2
pawn Код:
COMMAND:fp(playerid, params[])
{
new PlayerId;
if(!sscanf(params, "d", PlayerId))
{
SendClientMessage(playerid, 0xFF00FFFF, "USAGE: /facepalm [id]");
return 1;
}
if(IsPlayerConnected(PlayerId))
{
SendClientMessage(playerid, 0xFFFFFFFF, "Player is not connected");
return 1;
}
new Str[128];
new MyName[24], HisName[24];
GetPlayerName(playerid, MyName, 24);
GetPlayerName(PlayerId, HisName, 24);
format(Str, 128, "%s facepalms towards %s", MyName, HisName);
SendClientMessageToAll(0xFFFFFFFF, Str);
return 1;
}
Should works. Code's messy, but thats my special [nah, i am in hurry.. ]
PS. Be patient!
Greetz,
LetsOWN
Re: Facepalm Command!? -
martin3644 - 18.12.2012
Thank you and yes I have sscanf2 and zcmd. I check this.
Re: Facepalm Command!? -
LetsOWN[PL] - 18.12.2012
Hah, allright.
Good luck in future
Greetz,
LetsOWN
Re: Facepalm Command!? -
martin3644 - 18.12.2012
Doesnt Work. Sorry! -.-
No errors but the other commands dont work propertly and this command doesnt work too -.-
But Thank You!
Re: Facepalm Command!? -
yaron0600 - 18.12.2012
Check if you put all in the right place...
Re: Facepalm Command!? -
Mr.Anonymous - 18.12.2012
Try this:
pawn Код:
COMMAND:fp(playerid, params[])
{
new Player;
new Str[128], Name[24], Target[24];
if(!sscanf(params, "d", Target)) return SendClientMessage(playerid, 0xFF00FFFF, "USAGE: /facepalm [id]");
if(!IsPlayerConnected(Target))
SendClientMessage(playerid, 0xFFFFFFFF, "Player is not connected");
GetPlayerName(playerid, Name, 24);
GetPlayerName(PlayerId, Target, 24);
format(Str, 128, "%s facepalms towards %s", Name, Target);
SendClientMessageToAll(0xFFFFFFFF, Str);
return 1;
}
Re: Facepalm Command!? -
Mike_Peterson - 18.12.2012
Hmm, I actually hoped you didnt have sscanf and zcmd, i specially wroted and tested it for you, since you share my name (my name isnt Mike but Martin)
pawn Код:
new cmd[128], tmp[128];
tmp = strtok(cmdtext, idx);
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/fp", true) == 0)
{
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /fp [id]");
if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, 0xFFFFFFFF, "Player not connected.");
new str[128],fpname[MAX_PLAYER_NAME],myname[MAX_PLAYER_NAME];
GetPlayerName(strval(tmp),fpname,sizeof(fpname));
GetPlayerName(playerid,myname,sizeof(myname));
format(str,128,"%s facepalms on %s's comment.",myname,fpname);
SendClientMessageToAll(0xFF66FFAA,str);
return 1;
}
copy paste it right into onplayercommandtext and no errors will show up, if the 'cmd' and 'tmp' variables arent defined yet.
edit: EDITED and works now if done correctly.
Re: Facepalm Command!? -
martin3644 - 18.12.2012
Quote:
Originally Posted by Mr.Anonymous
Try this:
pawn Код:
COMMAND:fp(playerid, params[]) { new Player; new Str[128], Name[24], Target[24]; if(!sscanf(params, "d", Target)) return SendClientMessage(playerid, 0xFF00FFFF, "USAGE: /facepalm [id]");
if(!IsPlayerConnected(Target)) SendClientMessage(playerid, 0xFFFFFFFF, "Player is not connected");
GetPlayerName(playerid, Name, 24); GetPlayerName(PlayerId, Target, 24); format(Str, 128, "%s facepalms towards %s", Name, Target); SendClientMessageToAll(0xFFFFFFFF, Str); return 1; }
|
Doesn't work. I check this and when I type /fp it says Mexix facepalms towards Mexix (Mexix is my in game name)