SA-MP Forums Archive
Setup to Affect Other Player It Affects You - 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: Setup to Affect Other Player It Affects You (/showthread.php?tid=346035)



Setup to Affect Other Player It Affects You - Robert_Crawford - 27.05.2012

Hey guys when i do like /goto it teleports me to myself if i do either name or id. But the part that bugs me is that it affects all of my commands. Suchas /goto /get /set /makeleader

pawn Код:
CMD:goto(playerid, params[]) {
    if(playerVariables[playerid][pAdminLevel] >= 1) {
        new
            userID;

        if(sscanf(params, "u", userID)) {
            return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/goto [playerid]");
        }
        else {
            if(!IsPlayerConnected(userID)) return SendClientMessage(playerid, COLOR_GREY, "The specified player ID is either not connected or has not authenticated.");

            new
                messageString[64],

                Float: fPos[3];

            GetPlayerPos(userID, fPos[0], fPos[1], fPos[2]);

            if(GetPlayerState(playerid) == 2) {

                SetVehiclePos(GetPlayerVehicleID(playerid), fPos[0], fPos[1]+2, fPos[2]);

                LinkVehicleToInterior(GetPlayerVehicleID(playerid), GetPlayerInterior(userID));
                SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(userID));
            }

            else SetPlayerPos(playerid, fPos[0], fPos[1]+2, fPos[2]);

            SetPlayerInterior(playerid, GetPlayerInterior(userID));
            SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(userID));

            GetPlayerName(userID, szPlayerName, MAX_PLAYER_NAME);

            format(messageString, sizeof(messageString), "You have teleported to %s.", szPlayerName);
            SendClientMessage(playerid, COLOR_WHITE, messageString);
        }
    }

    return 1;
}

CMD:setleader(playerid, params[]) {
    if(playerVariables[playerid][pAdminLevel] >= 3) {
        new
            groupID,
            userID;

        if(sscanf(params, "ud", userID, groupID)) {
            return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/setleader [playerid] [groupid]");
        }
        else {
            if(groupID < 1 || groupID > MAX_GROUPS) return SendClientMessage(playerid, COLOR_GREY, "Invalid group ID.");

            playerVariables[userID][pGroup] = groupID;
            playerVariables[userID][pGroupRank] = 6;

            new

                string[128];

            GetPlayerName(userID, szPlayerName, MAX_PLAYER_NAME);

            format(string, sizeof(string), "You have set %s to lead group %s.", szPlayerName, groupVariables[groupID][gGroupName]);
            SendClientMessage(playerid, COLOR_WHITE, string);

            GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

            format(string, sizeof(string), "Administrator %s has set you to lead group %s.", szPlayerName, groupVariables[groupID][gGroupName]);
            SendClientMessage(userID, COLOR_WHITE, string);
        }
    }

    return 1;
}



Re: Setup to Affect Other Player It Affects You - Robert_Crawford - 27.05.2012

Bump Bump


Re: Setup to Affect Other Player It Affects You - vvhy - 27.05.2012

do you have sscanf.inc or sscanf2.inc or what?