Need /slap [ID] [how high you go when slapped]
#1

I need a command like /slap [ID] but this one also lets you decide how high up you slap them.
Reply
#2

pawn Код:
CMD:slap(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] >= 2) //Change to your admin variable / admin level
    {
        new targetid, height, string[128], Pos[3], playername[24], othername[24];
        if(sscanf(params, "uI(10)", targetid, height)) return SendClientMessage(playerid, COLOR_GRAY, "Usage: /slap [playerid/partofname] [height]");
        else if(!IsPlayerConnected(targetid)) return SendClientMessageEx(playerid, COLOR_GRAY, "Invalid player specified.");

        GetPlayerName(playerid, playername, sizeof(playername));
        GetPlayerName(targetid, othername, sizeof(othername));
        format(string, sizeof(string), "AdmCmd: %s has slapped (ID: %i) %s.", playername, targetid, othername);
        SendClientMessageToAll(-1, string);

        GetPlayerPos(targetid, Pos[0], Pos[1], Pos[2]);
        SetPlayerPos(targetid, Pos[0], Pos[1], Pos[2] + height);
    }
    return 1;
}
Abracadavre motherfucker. Slave work is now complete.

(requires ZCMD and sscanf.)

EDIT: Figured you'd like to have it optional, like the post below.
Reply
#3

@ kindred, watch ur language, dont call others names. this is how they should go

playerposy +5
Reply
#4

Quote:
Originally Posted by carz0159
Посмотреть сообщение
@ kindred, watch ur language, dont call others names. this is how they should go

playerposy +5
Why would you change there Y axis?

And I'm not calling anyone names, if you knew english you would know that I called myself a slave and I was joking around with the "abracabevre" thing, considering I did it quickly.
Reply
#5

Quote:
Originally Posted by Kindred
Посмотреть сообщение
pawn Код:
CMD:slap(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] >= 2) //Change to your admin variable / admin level
    {
        new targetid, height, string[128];
        if(sscanf(params, "ui", targetid, height)) return SendClientMessage(playerid, COLOR_GRAY, "Usage: /slap [playerid/partofname] [height]");
        else if(!IsPlayerConnected(targetid)) return SendClientMessageEx(playerid, COLOR_GRAY, "Invalid player specified.");

        format(string, sizeof(string), "AdmCmd: %s has slapped (ID: %i) %s.", GetRPName(playerid), targetid, GetRPName(targetid));
        SendClientMessageToAll(-1, string);

        GetPlayerPos(targetid, PlayerInfo[targetid][pPositionX], PlayerInfo[targetid][pPositionY], PlayerInfo[targetid][pPositionZ]);
        SetPlayerPos(targetid, PlayerInfo[targetid][pPositionX], PlayerInfo[targetid][pPositionY], PlayerInfo[targetid][pPositionZ] + height);
    }
    return 1;
}
Abracadavre motherfucker. Slave work is now complete.

(requires ZCMD and sscanf.)
This is wrong.
Padminlevel is an unknown function here.
You haven't made new functions.
And color is also not defined.
Looks like you've taken from other script.
Reply
#6

Quote:
Originally Posted by Kalroz
Посмотреть сообщение
This is wrong.
Padminlevel is an unknown function here.
You haven't made new functions.
And color is also not defined.
Looks like you've taken from other script.
LOL, yes, I did take it from another script, MY SCRIPT.

Of course it isn't defined, if he knew how to script he would know.

I wrote to change the padminlevel to a different variable, depending on his variable, I just forgot to tell him to change things that weren't defined.

EDITED the post, it's fixed, all he needs is to change admin variable.

Happy?
Reply
#7

Quote:
Originally Posted by Ryan_Michael
Посмотреть сообщение
I need a command like /slap [ID] but this one also lets you decide how high up you slap them.
pawn Код:
CMD:slap(playerid,params[])
{
    new targetid,height;
    if(sscanf(params,"uI(10)",targetid,height)) return SendClientMessage(playerid,-1,"USAGE : /slap [id] [height]");
    if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"Player not connected || Invalid Id");
    new Float:pos[3];
    GetPlayerPos(targetid,pos[0],pos[1],pos[2]);
    SetPlayerPos(targetid,pos[0],pos[1],pos[2] + height);
    new msg[128];
    new pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,24);
    GetPlayerName(targetid,tName,24);
    format(msg,sizeof(msg),"%s(%d) slapped %s(%d)",pName,playerid,tName,targetid);
    SendClientMessageToAll(-1,msg);
    return 1;
}
You will need sscanf2 and ZCMD.

Height is optional.
If you do /slap 0, it will set player height 10.
* [MM]RoXoR[FS] slaps 0 2 , it will set player height to 2. around a bit with a large trout.
Reply
#8

Quote:
Originally Posted by [MM]RoXoR[FS]
Посмотреть сообщение
pawn Код:
CMD:slap(playerid,params[])
{
    new targetid,height;
    if(sscanf(params,"uI(10)",targetid,height)) return SendClientMessage(playerid,-1,"USAGE : /slap [id] [height]");
    if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"Player not connected || Invalid Id");
    new Float:pos[3];
    GetPlayerPos(targetid,pos[0],pos[1],pos[2]);
    SetPlayerPos(targetid,pos[0],pos[1],pos[2] + height);
    new msg[128];
    new pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,24);
    GetPlayerName(targetid,tName,24);
    format(msg,sizeof(msg),"%s(%d) slapped %s(%d)",pName,playerid,tName,targetid);
    SendClientMessageToAll(-1,msg);
    return 1;
}
You will need sscanf2 and ZCMD.

Height is optional.
If you do /slap 0, it will set player height 10.
* Kindred slaps 0 2 , it will set player height to 2. around a bit with a large trout.
Waste of lines, you can easily make every single new in one line, and it would look neater.

Код:
!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID
Doesn't this mean EXACTLY the same thing? If the player is not connected, it is an invalid player id.
Reply
#9

Thank you Kindred they are not smart enough to know you need to define the things to work on your server or like my change it to pAdmin to work. I would REP but it wont let me. I gave you too much rep already and says i need to spread it.
Reply
#10

function
pawn Код:
stock SetHeight(playerid,height)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);

    SetPlayerPos(playerid,x,y,z+height);
   return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)