Help with one of my codes!
#1

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!!!!
Reply
#2

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
Reply
#3

ty but i fixed already

ty alot though for being nice and helping
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)