22.07.2012, 04:28
I need a command like /slap [ID] but this one also lets you decide how high up you slap them.
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;
}
@ kindred, watch ur language, dont call others names. this is how they should go
playerposy +5 |
pawn Код:
(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. |
I need a command like /slap [ID] but this one also lets you decide how high up you slap them.
|
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;
}
pawn Код:
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. |
!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID
stock SetHeight(playerid,height)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
SetPlayerPos(playerid,x,y,z+height);
return 1;
}