SA-MP Forums Archive
A few questions. - 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)
+--- Thread: A few questions. (/showthread.php?tid=464720)



A few questions. - CesarLT - 18.09.2013

Hello everyone, I am kinda new to scripting and I got really into it. So I have a few questions which I don't seem to be able to figure out myself, first of all thank you in advance to all those who will answer.

1. How to create a DM area, which when a player will get into it will get specific weapons (I know how to do that), but
when he will leave his weapons will return to default (The once he had before) no matter to which area will he teleport.

2. How to make it possible to use let's say a /buyguns cmd, only near a specific place I'll choose. (Let's say a gun store).

3. How can I make a race? (Checkpoints changing, I can create one but I can't make it lead to the second one..)

That's all for now...thanks in advance again.



Re: A few questions. - EiresJason - 18.09.2013

1:
pawn Код:
new PlayerPrevWeapon[MAX_PLAYERS][12]; //put these 2 above most of your script; put them above main().
new PlayerPrevAmmo[MAX_PLAYERS][12];

//Use the above variables before he enters the arena; it will be like..

for(new i=0;i<12;i++)
{
    GetPlayerWeaponData(playerid, i, PlayerPrevWeapon[playerid][i],  PlayerPrevWeapon[playerid][i]);
}
2: Go to where you want the person to be at and type /save /buygun position.
Go to GTA San Andreas User Files -> SAMP -> Savepositions and post the X/Y/Z from the line into the below function. Also; you can put radius as something like 5.0.
pawn Код:
IsPlayerInRangeOfPoint(playerid, Float:radius,Float:x,Float:y,Float:z);
3: Use this callback. EDIT: Read what Kon posted
pawn Код:
OnPlayerEnterRaceCheckpoint(playerid)



Re: A few questions. - Konstantinos - 18.09.2013

1. To where they join to DM, use GetPlayerWeaponData and store the player's weapon data into some arrays. Resets the weapons, give the weapons you want. When it's about to exit, reset the weapons and use a for loop like the example of GetPlayerWeaponData but use GivePlayerWeapon to give the weapons the player had.

2. When they execute /buyguns, check if they are in range of the coordinates you want. You can use IsPlayerInRangeOfPoint for that.

3. I've recently given an example for that (It can be found here: http://forum.sa-mp.com/showpost.php?...15&postcount=2)
However, it's for one race, like I said to that post. You need another array that handles the raceid.


Re: A few questions. - CesarLT - 18.09.2013

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
1:
pawn Код:
new PlayerPrevWeapon[MAX_PLAYERS][12]; //put these 2 above most of your script; put them above main().
new PlayerPrevAmmo[MAX_PLAYERS][12];

//Use the above variables before he enters the arena; it will be like..

for(new i=0;i<12;i++)
{
    GetPlayerWeaponData(playerid, i, PlayerPrevWeapon[playerid][i],  PlayerPrevWeapon[playerid][i]);
}
2: Go to where you want the person to be at and type /save /buygun position.
Go to GTA San Andreas User Files -> SAMP -> Savepositions and post the X/Y/Z from the line into the below function. Also; you can put radius as something like 5.0.
pawn Код:
IsPlayerInRangeOfPoint(playerid, Float:radius,Float:x,Float:y,Float:z);
3: Use this callback. EDIT: Read what Kon posted
pawn Код:
OnPlayerEnterRaceCheckpoint(playerid)
Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
1. To where they join to DM, use GetPlayerWeaponData and store the player's weapon data into some arrays. Resets the weapons, give the weapons you want. When it's about to exit, reset the weapons and use a for loop like the example of GetPlayerWeaponData but use GivePlayerWeapon to give the weapons the player had.

2. When they execute /buyguns, check if they are in range of the coordinates you want. You can use IsPlayerInRangeOfPoint for that.

3. I've recently given an example for that (It can be found here: http://forum.sa-mp.com/showpost.php?...15&postcount=2)
However, it's for one race, like I said to that post. You need another array that handles the raceid.
Thanks, and thanks I'll start trying


Respuesta: A few questions. - RafaelZam - 18.09.2013

2_
with dialogs you can create it
3_
maybe with this web page you may make a good race
http://codegenerators.pl/race
there you can create a race


Re: A few questions. - kalanerik99 - 18.09.2013

1.

You can use my tutorial or download my script


Tutorial

Script for rocket and sniper deathmach