Licenses command help. -
Dizzle - 18.10.2012
So, I've decided to make a simple licenses system, driving, flying and gun license - but anyways, lets move to the question:
Im trying to make it when a player type /mylic to show him if the license is "Passed" or "Not Passed" Instead of 0 or 1, if you still didnt get what I mean - here's a screenshot.
So, my problem is that when I try to make it like this -
Код:
CMD:mylic(playerid, params[])
{
new lic[128];
if(HasDrivingLic[playerid] == 0 || HasGunLic[playerid] == 0 || HasFlyingLic[playerid] == 0)
format(lic, sizeof(lic), "** Your Licenses - [Driving]: Not Passed || [Gun]: Not Passed || [Flying]: Not Passed");
else
if(HasDrivingLic[playerid] == 1 || HasGunLic[playerid] == 0 || HasFlyingLic[playerid] == 0)
format(lic, sizeof(lic), "** Your Licenses - [Driving]: Passed || [Gun]: Not Passed || [Flying]: Not Passed");
else
if(HasDrivingLic[playerid] == 0 || HasGunLic[playerid] == 1 || HasFlyingLic[playerid] == 0)
format(lic, sizeof(lic), "** Your Licenses - [Driving]: Not Passed || [Gun]: Passed || [Flying]: Not Passed");
else
if(HasDrivingLic[playerid] == 0 || HasGunLic[playerid] == 0 || HasFlyingLic[playerid] == 1)
format(lic, sizeof(lic), "** Your Licenses - [Driving]: Not Passed || [Gun]: Not Passed || [Flying]: Passed");
else
if(HasDrivingLic[playerid] == 1 || HasGunLic[playerid] == 1 || HasFlyingLic[playerid] == 1)
format(lic, sizeof(lic), "** Your Licenses - [Driving]: Passed || [Gun]: Passed || [Flying]: Passed");
SendClientMessage(playerid, -1, lic);
return 1;
}
It doesnt shows the licenses correctly, even if you buy one it shows you dont have it, but if you buy two licenses it shows you got all of them... Im pretty confused, so I would be happy if someone tell me what I did wrong.
Re : Licenses command help. -
lelemaster - 18.10.2012
Код:
CMD:mylic(playerid, params[])
{
new lic[128], divinglic[12], gunlic[12],flyinglic[12];
if(HasDrivingLic[playerid] == 0) drivinglic = "Not Passed";
else drivinglic = "Passed";
if(HasGunLic[playerid] == 0) gunlic = "Not Passed";
else gunlic = "Passed";
if(HasFlyingLic[playerid] == 0) flyinglic = "Not Passed";
else flyinglic = "Passed";
format(lic, sizeof(lic), "** Your Licenses - [Driving]: %s || [Gun]: %s || [Flying]: %s", drivinglic,gunlic,flyinglic);
SendClientMessage(playerid, -1, lic);
return 1;
}
Re: Licenses command help. -
newbienoob - 18.10.2012
Why you are using format? Just use SendClientMessage instead.
Oh and don't use "||", use "&&"
Код:
if(HasDrivingLic[playerid] == 0 && HasGunLic[playerid] == 0 && HasFlyingLic[playerid] == 0) SendClientMessage(playerid,-1,"** Your Licenses - [Driving]: Not Passed || [Gun]: Not Passed || [Flying]: Not Passed"
Re : Licenses command help. -
lelemaster - 18.10.2012
His codes are just inneficient, because he'll have to make 27 if statements on his way. ( 3 driving x 3 gun x 3 flying = 27)
The way I showed him is more efficient.
Re: Licenses command help. -
Dizzle - 18.10.2012
Thanks ! I've tried everything BUT this, both +Repped.