SA-MP Forums Archive
Crash near command - 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: Crash near command (/showthread.php?tid=363325)



Crash near command - NinjaChicken - 27.07.2012

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


Re: Crash near command - Andi_Evandy - 27.07.2012

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


Re: Crash near command - NinjaChicken - 27.07.2012

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


Re: Crash near command - Andi_Evandy - 27.07.2012

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".



Re: Crash near command - NinjaChicken - 27.07.2012

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