Crashes (like anti crash)
#1

I need a command that will crash players game.
and i need anti crash that if there is crash (not from the crash command) it will return the game
can you help me?
Reply
#2

O.o nub, you have alot of options to crash:

firs you need strtok
https://sampwiki.blast.hk/wiki/Strtok
put this in public OnPlayerCommandText(playerid, cmdtext[])
pawn Код:
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
option 1:
pawn Код:
if(strcmp(cmd, "/crash", true) == 0)
    {
        new tmp[128];
        tmp = strtok(cmdtext, idx);
 
        if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /crash [playerid]");
 
        CreatePlayerObject(strval(tmp), 9999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/crash", true) == 0)
    {
        new tmp[128];
        tmp = strtok(cmdtext, idx);
 
        if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /crash [playerid]");
 
        SetPlayerPos(strval(tmp), 99999999999.9, 999999999999.9, 9999999999999.9);
        return 1;
    }
Reply
#3

Or I can do all of them to make sure it will crash:
pawn Код:
new cmd[128], idx;
cmd = strtok(cmdtext, idx);

if(strcmp(cmd, "/crash", true) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
 
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /crash [playerid]");
 
CreatePlayerObject(strval(tmp), 9999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
SetPlayerPos(strval(tmp),9999999.9,9999999.9, 9999999.9);
CreateVehicle(strval(tmp),999999, 0.0, 0.0);
return 1;
}
so is it gonna work
Reply
#4

pawn Код:
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
pawn Код:
if(strcmp(cmd, "/crash", true) == 0)
    {
        new tmp[128];
        tmp = strtok(cmdtext, idx);
 
        if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /crash [playerid]");
         new Float:X,Float:Y,Float:Z;
         new targetid = ReturnUser(tmp);
         GetPlayerPos(targetid,X,Y,Z);
         new objectcrash = CreatePlayerObject(targetid,666666,X,Y,Z,0,0,0);
         SendClientMessage(playerid,GREEN, "Player successfuly crashed.");
         DestroyPlayerObject(targetid, objectcrash);
        return 1;
    }
Reply
#5

Quote:
Originally Posted by saiberfun
pawn Код:
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
pawn Код:
if(strcmp(cmd, "/crash", true) == 0)
    {
        new tmp[128];
        tmp = strtok(cmdtext, idx);
 
        if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /crash [playerid]");
         new Float:X,Float:Y,Float:Z;
        new targetid = ReturnUser(tmp);
         GetPlayerPos(targetid,X,Y,Z);
         new objectcrash = CreatePlayerObject(targetid,666666,X,Y,Z,0,0,0);
         SendClientMessage(playerid,GREEN, "Player successfuly crashed.");
         DestroyPlayerObject(targetid, objectcrash);
        return 1;
    }
why to put that away from the code:
pawn Код:
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
Reply
#6

Quote:
Originally Posted by nuriel8833
why to put that away from the code:
pawn Код:
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
it needs to stand alone as first under OnPlayerCommandText
then u don'T need to define it at every cmd where u use strtok again.
Reply
#7

OK but make sure it will crash XD
make also unkdown vehicle and pickup and set the player position for unkdown position (999999.9,99999.9,9999999.9) OK?
Reply
#8

ok , all good , but the anticrash??
Reply
#9

Quote:

CreatePlayerObject(strval(tmp), 9999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

on objects you must be carful, a wrong object id can crash you and maybe too...
Reply
#10

Quote:
Originally Posted by [DFE
Roy ]
Quote:

CreatePlayerObject(strval(tmp), 9999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

on objects you must be carful, a wrong object id can crash you and maybe too...
But if im using strval(tmp) it will crash other player right
and what about Vehicles
Im not using AddStaticVehicle Im using CreatVehicle And Creat Object
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)