Crashes (like anti crash) -
nuriel8833 - 28.07.2009
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?
Re: Crashes (like anti crash) -
Daem - 28.07.2009
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;
}
Re: Crashes (like anti crash) -
nuriel8833 - 28.07.2009
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
Re: Crashes (like anti crash) -
saiberfun - 28.07.2009
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;
}
Re: Crashes (like anti crash) -
nuriel8833 - 28.07.2009
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);
Re: Crashes (like anti crash) -
saiberfun - 28.07.2009
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.
Re: Crashes (like anti crash) -
nuriel8833 - 28.07.2009
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?
Re: Crashes (like anti crash) -
Serediucr - 28.07.2009
ok , all good , but the anticrash??
Re: Crashes (like anti crash) -
[DFE]Roy - 28.07.2009
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...
Re: Crashes (like anti crash) -
nuriel8833 - 28.07.2009
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