Crash near command
#1

ok so ive made this cmd

pawn Код:
CMD:crash(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 99999)
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command!");
        return 1;
    }

    new
        id;
    if(sscanf(params, "ud", id)) return SendClientMessage(playerid, -1, "USE: /crash [ID]");
    SendClientMessageEx(playerid, COLOR_RED, "Please note this command will crash the given player");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Player not connected.");
    GameTextForPlayer(id, "%%$#@1~555#",66666000, 6);
    return 1;
}
i wanna transfer it to a /crashnear where i type the radius such as /crashnear 100 will crash players in the radious of 100
Reply
#2

pawn Код:
CMD:crashnear(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 99999)
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command!");
        return 1;
    }
    new Float:range, Float:pX, Float:pY, Float:pZ;
    if(sscanf(params, "f", range)) return SendClientMessage(playerid, -1, "USE: /crashnear [Range]");
    SendClientMessageEx(playerid, COLOR_RED, "Please note this command will crash the given player");
    GetPlayerPos(playerid, pX, pY, pZ);
    for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, range, pX, pY, pZ) && i != playerid) GameTextForPlayer(i, "%%$#@1~555#",66666000, 6);
    return 1;
}
untested btw
Reply
#3

thanks il test but the problem is won't it crash me aswell?
Reply
#4

no, it won't
pawn Код:
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, range, pX, pY, pZ) && i != playerid) GameTextForPlayer(i, "%%$#@1~555#",66666000, 6); //it will check if player "i" is connected, near "playerid", and player "i" is not "playerid".
Reply
#5

nvm it worked but can someone make like a warning thing so they type it , it tells them a warning saying it will crash them thrn if they type it again they will crash, can it be fore both the cmds pelase
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)