SA-MP Forums Archive
Buy armour - 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: Buy armour (/showthread.php?tid=88707)



Buy armour - kimse007 - 28.07.2009

Quote:

//buy armour

if (strcmp("/buyarmour", cmdtext, true, 10) == 0)
{
if GetPlayerMoney(playerid) => 1000;
SetPlayerArmour(playerid, 100.0);
SendClientMessage(playerid, 0xFFFFFFAA, "Armor for you!");
GivePlayerMoney(playerid, -1000);


else
SendClientMessage(playerid, 0xFFFFFFAA, "Poor bastard, Get some money!");

return 1;


}

When you got 1000 you should be able to buy armour. If you don't have that it should return the message poor bastard. If you can correct it and explain what I did wrong, I would appreciate that.

Thanks in advance.


Re: Buy armour - Criss_Angel - 28.07.2009

Quote:
Originally Posted by kimse007
Quote:

//buy armour

if (strcmp("/buyarmour", cmdtext, true, 10) == 0)
{
if GetPlayerMoney(playerid) => 1000;
SetPlayerArmour(playerid, 100.0);
SendClientMessage(playerid, 0xFFFFFFAA, "Armor for you!");
GivePlayerMoney(playerid, -1000);
}
els
SendClientMessage(playerid, 0xFFFFFFAA, "Poor bastard, Get some money!");

return 1;


}

try this
Код:
	if (strcmp("/buyarmour", cmdtext, true, 10) == 0)
	{
  	if GetPlayerMoney(playerid) => 1000);
  	SetPlayerArmour(playerid, 100.0);
  	SendClientMessage(playerid, 0xFFFFFFAA, "Armor for you!");
  		GivePlayerMoney(playerid, -1000);
    
    }
	else
    {
	SendClientMessage(playerid, 0xFFFFFFAA, "Poor bastard, Get some money!");
    }
		return 1;


	}



Re: Buy armour - -Sneaky- - 28.07.2009

pawn Код:
if (strcmp("/buyarmour", cmdtext, true, 10) == 0)
{
  if(GetPlayerMoney(playerid) < 1000)
    return SendClientMessage(playerid, 0xFFFFFFAA, "Poor bastard, Get some money!");

  SetPlayerArmour(playerid, 100.0);
  SendClientMessage(playerid, 0xFFFFFFAA, "Armor for you!");
  GivePlayerMoney(playerid, -1000);
  return 1;
}



Re: Buy armour - kimse007 - 28.07.2009

Thanks guys

I got problems with this one as well:

Quote:

if (strcmp("/minigun", cmdtext, true, 10) == 0)
{

(IsPlayerAdmin(playerid));
GivePlayerWeapon(Playerid, 38, 99999);
}

else {
SendClientMessage(playerid, 0xFFFFFFAA, "Sorry you are not allowed to use this");

return 1;
}

I want to use it only for admins who are logged on with rcon.


Re: Buy armour - ronyx69 - 28.07.2009

if (strcmp("/minigun", cmdtext, true, 10) == 0)
{
if(IsPlayerAdmin(playerid))
{
GivePlayerWeapon(Playerid, 38, 99999);
}
else
{
SendClientMessage(playerid, 0xFFFFFFAA, "Sorry you are not allowed to use this");
return 1;
}


Re: Buy armour - kimse007 - 28.07.2009

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{

if (strcmp("/minigun", cmdtext, true, 10) == 0)
{
if(IsPlayerAdmin(playerid))
{
GivePlayerWeapon(Playerid, 38, 99999);
}
else
{
SendClientMessage(playerid, 0xFFFFFFAA, "Sorry you are not allowed to use this");
return 1;
}

Doesn't work: C:\Users\Kim\Desktop\server mods\gamemodes\kims.pwn(22 : error 017: undefined symbol "Playerid"


Re: Buy armour - ronyx69 - 28.07.2009

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

  if (strcmp("/minigun", cmdtext, true, 10) == 0)
  {
  if(IsPlayerAdmin(playerid))
  {
  GivePlayerWeapon(playerid, 38, 99999);
  }
  else
  {
  SendClientMessage(playerid, 0xFFFFFFAA, "Sorry you are not allowed to use this");
  return 1;
  }



Re: Buy armour - BMUK - 28.07.2009

Playerid and playerid are two different things because of the capital letter.

You need just playerid


Re: Buy armour - kimse007 - 28.07.2009

[me=kimse007]shakes his head.[/me]

Damn small mistakes can do a huge difference. Anyway thanks for the help guys


Re: Buy armour - miceiken - 28.07.2009

Seriously, learn to read and debug your own errors. This is like 2nd grade logics