SA-MP Forums Archive
Help with one of my codes! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with one of my codes! (/showthread.php?tid=67522)



Help with one of my codes! - Yoyoyo - 01.03.2009

Hey. Thank you for checking this out. I have a code like this:

---------------------------------------------------------------------------------------

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/missle", cmdtext, true, 7) == 0)
{
if(strlen(cmdtext[8]) == 0) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /missle <PlayerID>");
if(IsPlayerConnected(strval(cmdtext[8])) == 0) return SendClientMessage(playerid, 0xFF0000AA, "Player Not Found");

new FloatX, FloatY, FloatZ, Float:vX, Float:vY, Float:vZ;
GetPlayerPos(playerid, pX, pY, pZ);
GetPlayerPos(strval(cmdtext[8]), vX, vY, vZ);

if(pX - vX < 10 && pX - vX > -10 && pY - vY < 10 && pY - vY > -10 && pZ - vZ < 10 && pZ - vZ > -10)
{
CreateExplosion(?);
SendClientMessage(strval(cmdtext[8]), 0x00FF00AA, "You have been exploded.");
SendClientMessage(playerid, 0x00FF00AA, "Player Destroyed");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You are too far apart.");
}
return 1;
}
return 0;
}

------------------------------------------------------------------------------------------------
But as you can see where it says CreateExplosion there is a question mark. There, how do you make a explosion at the other players position. I tried CreateExplosion(strval, X, Y, Z, 50.0); But i get error and i dont know if its right. Please help!!! TY!!!!


Re: Help with one of my codes! - 1337pr0 - 02.03.2009

You should use [ pawn ] tags when posting code - like this:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/missle", cmdtext, true, 7) == 0)
 {
   if(strlen(cmdtext[8]) == 0) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /missle <PlayerID>");
   if(IsPlayerConnected(strval(cmdtext[8])) == 0) return SendClientMessage(playerid, 0xFF0000AA, "Player Not Found");

   new Float:pX, Float:pY, Float:pZ, Float:vX, Float:vY, Float:vZ;
   GetPlayerPos(playerid, pX, pY, pZ);
   GetPlayerPos(strval(cmdtext[8]), vX, vY, vZ);

   if(pX - vX < 10 && pX - vX > -10 && pY - vY < 10 && pY - vY > -10 && pZ - vZ < 10 && pZ - vZ > -10)
   {
    CreateExplosion(?);
    SendClientMessage(strval(cmdtext[8]), 0x00FF00AA, "You have been exploded.");
    SendClientMessage(playerid, 0x00FF00AA, "Player Destroyed");
   }
   else
   {
    SendClientMessage(playerid, 0xFF0000AA, "You are too far apart.");
   }
   return 1;
 }
return 0;
 }
Now, to fix the code.

CreateExplosion(Float:X, Float:Y, Float:Z, type, Float:radius)

As you can see, CreateExplosion needs 5 paramaters, not just X, Y, Z and size.

I'll do the explosion type for you:

pawn Код:
CreateExplosion(vX, vY, vZ, 7, 50)
That will create an explosion of type 7 (Huge) with a radius of 50.

https://sampwiki.blast.hk/wiki/CreateExplosion
https://sampwiki.blast.hk/wiki/Explosion_List


Re: Help with one of my codes! - Yoyoyo - 02.03.2009

ty but i fixed already

ty alot though for being nice and helping