How to make simple gunshop [tutorial]
#1

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

Nice, I might learn p2p through this
Reply
#3

Something wrong in ur post
Command return true before last bracket.
PointToPoint waste ur cpu
http://y-less.pastebin.ca/1299061
Reply
#4

Well i found this PlayerToPoint in one script, It works in my 3 gamemodes. I dont see what's wrong here, works perfectly...
Reply
#5

Just improve ur script skill^^
Reply
#6

I am working on it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)