Facepalm Command!?
#1

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!
Reply
#2

NoOne Know? I'm not very pro in scripting.

Sorry for bad English!
Reply
#3

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
Reply
#4

Thank you and yes I have sscanf2 and zcmd. I check this.
Reply
#5

Hah, allright.
Good luck in future

Greetz,
LetsOWN
Reply
#6

Doesnt Work. Sorry! -.-

No errors but the other commands dont work propertly and this command doesnt work too -.-

But Thank You!
Reply
#7

Check if you put all in the right place...
Reply
#8

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;
}
Reply
#9

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.
Reply
#10

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)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)