Command to buy a item
#1

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

try putting
pawn Код:
else if(PlayerInfo[playerid][pGunLic] == 1)
instead of
pawn Код:
if(PlayerInfo[playerid][pGunLic] == 1)
Reply
#3

no, thats not the problem
Reply
#4

thought so
Edit: why it's PlayerInfo[giveplayerid][pGunLic] = 1; and not PlayerInfo[playerid][pGunLic] = 1;
Reply
#5

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

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

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

I changed to giveplayerid, it works now but somehow it won't save to 1 in the user file

I have to check it
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)