How to make simple gunshop [tutorial] - 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: How to make simple gunshop [tutorial] (
/showthread.php?tid=64245)
How to make simple gunshop [tutorial] -
playdead - 03.02.2009
Hello again in my second tutorial. I'll show you how to make simple gunshop anywhere (you just need coordinates where).
Let's start.
First of all you need PlayerToPoint definition. Paste that on bottom of your script.
Код:
stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
Under line OnPlayerCommandText(playerid, cmdtext[]) (where you put commands for player).
Код:
if (strcmp(cmdtext, "/deagle", true) == 0)
{
if(PlayerToPoint(10, playerid, coordinates from gunshop))
{
GivePlayerWeapon(playerid, 24, 100); // 24 is desert eagle, 100 is ammo
return 1;
}
return 1;
}
You can add under GivePlayerWeapon like GivePlayerMoney(playerid, -1000); That will take 1000 $ from player. You can add SendClientMessage(playerid, white, "You bought desert eagle"); That will write You bought desert eagle when he types /deagle.
That is my another tutorial. Thanks for reading. PlayDead
Re: How to make simple gunshop [tutorial] -
Nimphious - 03.02.2009
Nice, I might learn p2p through this
Re: How to make simple gunshop [tutorial] -
yezizhu - 03.02.2009
Something wrong in ur post
Command return true before last bracket.
PointToPoint waste ur cpu
http://y-less.pastebin.ca/1299061
Re: How to make simple gunshop [tutorial] -
playdead - 03.02.2009
Well i found this PlayerToPoint in one script, It works in my 3 gamemodes. I dont see what's wrong here, works perfectly...
Re: How to make simple gunshop [tutorial] -
yezizhu - 03.02.2009
Just improve ur script skill^^
Re: How to make simple gunshop [tutorial] -
playdead - 03.02.2009
I am working on it