Buy armour
#1

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

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;


	}
Reply
#3

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;
}
Reply
#4

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.
Reply
#5

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;
}
Reply
#6

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

Код:
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;
  }
Reply
#8

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

You need just playerid
Reply
#9

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)