SA-MP Forums Archive
You ask, we answer. - 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: You ask, we answer. (/showthread.php?tid=89787)



You ask, we answer. - MenaceX^ - 04.08.2009

As Woet's thread is necessary to avoid people opening useless topics.
I had an idea to make a topic where people that don't understand FUNCTIONS only will ask here. And I will answer and give example (or who ever wants to.)
I'd like to mention that only questions are functions allowed, as people read at wiki and sometimes there aren't available examples so they open their topics here.
Just ask them here and wait to a reply.

Example how to ask:

The function you need help with:
Your problem with the function:


Who answers:

Function parameters(if who asked used it not correct, like string as an integer):
Sulotion:
Usage:




Have fun scripting.


Re: You ask, we answer. - sggassasin - 04.08.2009

hey there i made a script and now when i walk into the checkpoint it seend me under ground



and also how do i make it so you can only see the checkpoint from a sertain distence


Re: You ask, we answer. - Castle - 04.08.2009

Quote:
Originally Posted by sggassasin
hey there i made a script and now when i walk into the checkpoint it seend me under ground



and also how do i make it so you can only see the checkpoint from a sertain distence
Could you use the format maybe? or you don't understand English very well?

Also I need help with..
The function you need help with: strval
Your problem with the function: Not sure how to work with.


Re: You ask, we answer. - MenaceX^ - 04.08.2009

Function parameters: This function converts string to integer, could be used to select a number itself.
Sulotion: Code example, if you use strtok for example.
Usage:
pawn Код:
array=strtok(cmdtext,idx);
if(strval(array)==3) return SendClientMessage(playerid,color,"3"); // Means you wrote a command and then 3.



Re: You ask, we answer. - V1ceC1ty - 04.08.2009

- isPlayerInArea

i have this code so when it enters the area it sets players health to 999999 whatever but i need it so it also shows a TextDraw and when you leave the area it Destroys the TextDraw and sets the players health back to 100.

pawn Код:
public isPlayerInArea()
  {
    new Float:X, Float:Y, Float:Z;
    for(new i=0; i < MAX_PLAYERS; i++)
    {
      GetPlayerPos(i, X, Y, Z);
      if (X <= 1931.533813 && X >= 1323.255126 && Y <= 2036.987426 && Y >= 1364.370117)
      {
        SetPlayerHealth(i, 9999999.9);
      }
    }
  }
how would i do this?


Re: You ask, we answer. - MenaceX^ - 04.08.2009

I think you guys don't really understand what this thread is made for..
Vice City, you should go to scripting discussion.


Re: You ask, we answer. - V1ceC1ty - 04.08.2009

but its a function


Re: You ask, we answer. - MenaceX^ - 04.08.2009

1. You didn't use the format.
2. It's a scripting question and not a function question. You don't ask how to use this function, you ask how to show player a textdraw.


Re: You ask, we answer. - V1ceC1ty - 04.08.2009

The function you need help with: isPlayerInArea
Your problem with the function: i need to make it a safezone when you enter and when you leave 100 health but i dont know how?

Happy?


Re: You ask, we answer. - MenaceX^ - 04.08.2009

* Sighs.


Make a variable to check when a player enters the area, when he enters set it to true, when he gets out set it to false, if the variable is false, set up the textdraw to the player.

Now read my reply and understand yourself how my answer isn't even related to your problem.