Buy license
#1

guy I have problem I am still noob in scripting and I need help with /buylicense in city hall ... I have put it pickups into city hall and everything and I created /buylicense flying we I stand on that pickup I doenstn work can any onw say way....


Код:
if(strcmp(cmd, "/buylicense flying", true)== 0)
  	{
  		if(IsPlayerConnected(playerid))
  		{
    		if(PlayerToPoint(3.0,playerid, 369.4747,186.4138,1008.3893))
    		{
      		SendClientMessage(playerid, COLOR_YELLOW, "kupio si licencu za letenje");
	    		GivePlayerMoney(playerid, - 20000);
	    		PlayerInfo[playerid][pFlyLic] = 0;
	    		return 1;
    		}
  		}
	}
Reply
#2

I don't know if it's causing the problems but the return 1 is in the wrong place I think.. and the indentation isn't very good.. What exactly is wrong with it?

pawn Код:
if(strcmp(cmd, "/buylicense flying", true)== 0)
    {
    if(IsPlayerConnected(playerid))
        {
            if(PlayerToPoint(3.0,playerid, 369.4747,186.4138,1008.3893))
                {
            SendClientMessage(playerid, COLOR_YELLOW, "kupio si licencu za letenje");
                GivePlayerMoney(playerid, - 20000);
                PlayerInfo[playerid][pFlyLic] = 0;
                }
        }
    return 1;
    }
My only other guess is that the PlayerToPoint is malfunctioning.
Reply
#3

ok tnx for your help but nothing changed....everything is the same...
Reply
#4

pawn Код:
if(strcmp(cmd, "/buyflyinglicense", true)== 0) //It Might be because of the space in the command?
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerToPoint(3.0,playerid, 369.4747,186.4138,1008.3893))
        {
            SendClientMessage(playerid, COLOR_YELLOW, "kupio si licencu za letenje");
            GivePlayerMoney(playerid, - 20000);
            PlayerInfo[playerid][pFlyLic] = 0;
        }
    }
    return 1;
}
But what exactly is the problem, is the command just generally not working or what?
Reply
#5

You indent things differently to me.. moving the {}'s around is just aesthetic though >.>
Reply
#6

PlayerInfo[playerid][pFlyLic] = 1;

0 for no.
1 for yes.


That's typically how you would give a license..... but I don't know how you set it up.
Reply
#7

Код:
if(strcmp(cmd, "/buyflyinglicense", true) == 0)
{
if(PlayerInfo[playerid][pFlyLic] == 0)
{
if(GetPlayerCash(playerid) >= 10000)
{
GivePlayerCash(playerid,-10000);
SendClientMessage(playerid,COLOR_LIGHTGREEN,"You have just bought a flying license..");
PlayerInfo[playerid][pFlyLic] = 1;
OnPlayerDataSave(playerid);

}

else
{
SendClientMessage(playerid,COLOR_LIGHTGREEN,"You don't have enough money!");
}

}

else
{
SendClientMessage(playerid,COLOR_LIGHTGREEN,"You already have a license!");
}

return 1;
}
Sorry but i havent added cityhall position, do it yourself please..
Reply
#8

Quote:
Originally Posted by Lastman
Код:
if(strcmp(cmd, "/buyflyinglicense", true) == 0)
{
if(PlayerInfo[playerid][pFlyLic] == 0)
{
if(GetPlayerCash(playerid) >= 10000)
{
GivePlayerCash(playerid,-10000);
SendClientMessage(playerid,COLOR_LIGHTGREEN,"You have just bought a flying license..");
PlayerInfo[playerid][pFlyLic] = 1;
OnPlayerDataSave(playerid);

}

else
{
SendClientMessage(playerid,COLOR_LIGHTGREEN,"You don't have enough money!");
}

}

else
{
SendClientMessage(playerid,COLOR_LIGHTGREEN,"You already have a license!");
}

return 1;
}
Sorry but i havent added cityhall position, do it yourself please..
OnPlayerDataSave(playerid);
whered u get that from?
Reply
#9

Most likely its from whatever gamemode he's modifying.


Miokie should obviously ignore that line. He changed the language to english too, for reasons I cannot fathom.
Reply
#10

I do this and compile everything working than I go in game to city hall an show me everything its very nice than I type /buylicense flying
nothin like I dodnt wroted a command...

Код:
if(strcmp(cmd, "/buylicense flying", true) == 0)
	{
		if(PlayerInfo[playerid][pFlyLic] == 0)
		{
		  if(PlayerToPoint(3.0,playerid, 369.4747,186.4138,1008.3893))
		  {
				if(GivePlayerMoney(playerid) >= 20000)
				{
					GivePlayerMoney(playerid, - 20000);
					SendClientMessage(playerid,COLOR_LIGHTGREEN,"Kupio si Fly licensu..");
					PlayerInfo[playerid][pFlyLic] = 1;
				}
				else
				{
					SendClientMessage(playerid,COLOR_LIGHTGREEN,"Nemas Novca!");
				}

			}

			else
			{
				SendClientMessage(playerid,COLOR_LIGHTGREEN,"Pa vec imas tu licensu!");
			}
		}

		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)