Gethere & Slap Command?
#1

What is wrong with this 2 commands, it compiles just nothing happens ingame?

Код:
CMD:gethere(playerid,params[])
{
    if(PInfo[playerid][Level] < 2)
    {
        new id,Float:X,Float:Y,Float:Z,
        	pname[MAX_PLAYER_NAME],
			string[126],
		    name[MAX_PLAYER_NAME];
        if(sscanf(params, "u",id)) return SendClientMessage(playerid,RED,"Command format: /akill (playername/id) (reason)");
		if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,RED, "Error: Player is not connected!");
		if(id == playerid) return SendClientMessage(playerid,RED, "Error: You cannot get yourself!");
		new vWorld = GetPlayerVirtualWorld(playerid);
        SetPlayerVirtualWorld(id,vWorld);
        new Interior = GetPlayerInterior(playerid);
        SetPlayerInterior(id,Interior);
        SetPlayerVirtualWorld(id,GetPlayerVirtualWorld(playerid));
        GetPlayerPos(playerid,X,Y,Z);
        if(GetPlayerState(playerid) == 2)
		{
			SetVehiclePos(GetPlayerVehicleID(id),X+3,Y,Z);
			LinkVehicleToInterior(GetPlayerVehicleID(id),GetPlayerInterior(playerid));
			SetVehicleVirtualWorld(GetPlayerVehicleID(id),GetPlayerVirtualWorld(playerid));
		}
        else SetPlayerPos(id,X+2,Y,Z);
        GetPlayerName(playerid, pname, sizeof(pname));
        GetPlayerName(id, name, sizeof(name));
        format(string,sizeof(string),"Administrator %s(ID:%d) has teleported you to his/her position",Name(playerid), playerid);
        SendClientMessage(id,GREEN,string);
        format(string,sizeof(string),"You teleport %s(ID:%d) to your position", name, id);
        SendClientMessage(playerid,GREEN,string);
    }
    return 1;
}
&
Код:
CMD:slap(playerid, params[])
{
    new Float:x, Float:y, Float:z,Float:health;
    new string[128],
	    pname[MAX_PLAYER_NAME],
	    victimname[MAX_PLAYER_NAME],
	    victimid,
	    reason[30];
    if(PlayerInfo[playerid][Admin] > 1)
    {
	   if(sscanf(params, "us[30]", victimid, reason)) return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /slap <playerid/name> <reason>");
	   if(victimid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invalid-Playerid!");
	   if(victimid == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot slap yourself!");
	   GetPlayerPos(victimid, x, y, z);
       GetPlayerName(playerid, pname, sizeof(pname));
       GetPlayerName(victimid, victimname, sizeof(victimname));
       GetPlayerHealth(victimid, health);
       SetPlayerHealth(victimid, health-25);
	   SetPlayerPos(victimid, x, y, z+5);
	   format(string, sizeof(string), "%s(ID:%d) has been slap by Administrator %s(ID:%d) | Reason: %s", victimname, victimid, pname, playerid, reason);
	   SendClientMessageToAll(COLOR_RED, string);
	   format(string, sizeof(string), "You slap %s(ID:%d) | Reason: %s", victimname, victimid, reason);
	   SendClientMessage(playerid, COLOR_RED, string);
	   format(string, sizeof(string), "You have been slap by Administrator %s(ID:%d) | Reason: %s", pname, playerid, reason);
	   SendClientMessage(victimid, COLOR_RED, string);
       PlayerPlaySound(playerid, 1190, 0.0, 0.0, 0.0);
       PlayerPlaySound(victimid, 1190, 0.0, 0.0, 0.0);
	}
	return 1;
Reply
#2

pawn Код:
CMD:gethere(playerid, params[])
{
    if(pInfo[playerid][Level] > 2)
    {
        new
            victim,
            Float:x,
            Float:y,
            Float:z
        ;
       
        GetPlayerPos(playerid, x, y, z);
       
        if(!sscanf(params, "u", victim))
        {
            if( (IsPlayerConnected(victim)) && (victim != INVALID_PLAYER_ID) && (victim != playerid) )
            {
                if(!IsPlayerInAnyVehicle(victim)) {
                SetPlayerPos(victim, x+1, y+1, z);
                SetPlayerVirtualWorld(victim, GetPlayerVirtualWorld(playerid));
                SetPlayerInterior(victim, GetPlayerInterior(playerid)); }
                else {
                SetVehiclePos(GetPlayerVehicleID(victim), x+3, y+3, z);
                LinkVehicleToInterior(GetPlayerVehicleID(victim), GetPlayerInterior(playerid));
                SetVehicleVirtualWorld(GetPlayerVehicleID(victim), GetPlayerVirtualWorld(playerid)); }
               
            }
            else return SendClientMessage(playerid, RED, "ERROR: Player is yourself/disconnected/invalid");
        }
        else return SendClientMessage(playerid, RED, "USAGE: /gethere [playerid]");
    }
    else return SendClientMessage(playeird, RED,"ERROR: Level 3 and above only!");
    return 1;
}
Reply
#3

thanks for that, what about the slap?
Reply
#4

Can someone help with the .slap please
Reply
#5

use this one:
pawn Код:
dcmd_slap(playerid,params[]) {
    if(IsPlayerCommandLevel(playerid,"slap")) {
        if(!strlen(params)) return SendClientMessage(playerid,red,"Syntax Error: \"* Faisal_khan slaps <NICK OR ID> around a bit with a large trout.\".");
        new id; if(!IsNumeric(params)) id = ReturnPlayerID(params); else id = strval(params);
        if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid) {
            SendCommandMessageToAdmins(playerid,"SLAP");
            new string[256],name[24],ActionName[24]; GetPlayerName(playerid,name,24); GetPlayerName(id,ActionName,24);
            format(string,256,"Administrator \"%s\" has bitch-slapped \"%s\".",name,ActionName); SendClientMessageToAll(yellow,string);
            new Float:Health; GetPlayerHealth(id,Health); return SetPlayerHealth(id,Health-Config[SlapDecrement]);
        } else return SendClientMessage(playerid,red,"ERROR: You can not slap yourself or a disconnected player.");
    } else return SendLevelErrorMessage(playerid,"slap");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)