Command to buy a item -
Dripac - 16.03.2012
pawn Код:
if(strcmp(cmd, "/wschein", true) == 0)
{
if (!PlayerToPoint(3.0, playerid,249.4883,67.6739,1003.6406)) return SendClientMessage(playerid,COLOR_CRVENA,"[ERROR]:You cannot buy the weapon license here");
if(PlayerInfo[playerid][pGunLic] == 1) return SendClientMessage(playerid,COLOR_CRVENA,"[ERROR]:You already have a weapon license");
SendClientMessage(playerid,COLOR_INFO, "[INFO]:Waffenschein gekauft.");
PlayerInfo[giveplayerid][pGunLic] = 1;
GivePlayerCash(playerid, - 4000);
return true;
}
People can still use /wschein to buy a license, even if they got one, does anyone see whats wrong here?
Re: Command to buy a item -
[KHK]Khalid - 16.03.2012
try putting
pawn Код:
else if(PlayerInfo[playerid][pGunLic] == 1)
instead of
pawn Код:
if(PlayerInfo[playerid][pGunLic] == 1)
Re: Command to buy a item -
Dripac - 16.03.2012
no, thats not the problem
Re: Command to buy a item -
[KHK]Khalid - 16.03.2012
thought so
Edit: why it's PlayerInfo[giveplayerid][pGunLic] = 1; and not PlayerInfo[playerid][pGunLic] = 1;
Re: Command to buy a item -
Jonny5 - 16.03.2012
weird try this
pawn Код:
if(strcmp(cmd, "/wschein", true) == 0)
{
if (!PlayerToPoint(3.0, playerid,249.4883,67.6739,1003.6406)) {
SendClientMessage(playerid,COLOR_CRVENA,"[ERROR]:You cannot buy the weapon license here");
return 1;
}
if(PlayerInfo[playerid][pGunLic] == 1) {
SendClientMessage(playerid,COLOR_CRVENA,"[ERROR]:You already have a weapon license");
return 1;
}
SendClientMessage(playerid,COLOR_INFO, "[INFO]:Waffenschein gekauft.");
PlayerInfo[giveplayerid][pGunLic] = 1;
GivePlayerCash(playerid, - 4000);
return 1;
}
Re: Command to buy a item -
[KHK]Khalid - 16.03.2012
Quote:
Originally Posted by Jonny5
weird try this
pawn Код:
if(strcmp(cmd, "/wschein", true) == 0) { if (!PlayerToPoint(3.0, playerid,249.4883,67.6739,1003.6406)) { SendClientMessage(playerid,COLOR_CRVENA,"[ERROR]:You cannot buy the weapon license here"); return 1; } if(PlayerInfo[playerid][pGunLic] == 1) { SendClientMessage(playerid,COLOR_CRVENA,"[ERROR]:You already have a weapon license"); return 1; } SendClientMessage(playerid,COLOR_INFO, "[INFO]:Waffenschein gekauft."); PlayerInfo[giveplayerid][pGunLic] = 1; GivePlayerCash(playerid, - 4000); return 1; }
|
and what is the difference?
Re: Command to buy a item -
Jonny5 - 16.03.2012
what do you mean?
im not gonna explain the basics of the if .. else if.. logic to you.
theres many ways to write this code,
i would actually write it much different but just trying to get it working for them.
this code checks if
player is near the buying point.. if not send them message and stop the function
if passed then check for gun lic,
if they have a gun lic then send message and stop function
if no gun lic let them buy one.
edit:
on and your correct
giveplayerid should be playerid
i missed that
Re: Command to buy a item -
Dripac - 16.03.2012
I changed to giveplayerid, it works now but somehow it won't save to 1 in the user file
I have to check it