license system - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: license system (
/showthread.php?tid=68374)
license system -
thuron - 09.03.2009
hello,
I've got a license system, but i can't make it give a message when you already have a message, how do i do that??
this is the part of the script
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/buycarlic", cmdtext, true, 10) == 0)
{
if(PlayerToPoint(10.0,playerid,246.5378, 118.0774, 1003.2187))
{
if(5000 > GetPlayerMoney(playerid))
{
SendClientMessage(playerid,0x000087F6,"You don't have enough Money!");
return 1;
}
gLicenseC[playerid] = 1;
SendClientMessage(playerid,0x0000D4F6,"Thanks for Buying a Car License.");
GivePlayerMoney(playerid, -5000);
}
else
{
SendClientMessage(playerid,0x000087F6,"You have to be at the Main Hall to buy a licence!");
}
return 1;
}
I hope that someone can help me.
Re: license system -
MPKaboose - 09.03.2009
add somevere in the front of the command
pawn Код:
if (gLicenseC[playerid] == 1)
{
SendClientMessage(playerid,red,"You already have a license!");
}
else
{
//if player doesn't have a license
}
Re: license system -
MenaceX^ - 09.03.2009
pawn Код:
if(!strcmp(cmd,"/buylicense",true))
{
if(!PlayerToPoint(10.0,playerid,246.5378, 118.0774, 1003.2187))
return SendClientMessage(playerid,0x000087F6,"You have to be at the Main Hall to buy a licence!");
if(5000 > GetPlayerMoney(playerid))
return SendClientMessage(playerid,0x000087F6,"You don't have enough Money!");
if(gLicenseC[playerid])
return SendClientMessage(playerid,0x0000D4F6,"You already bought a license.");
gLicenseC[playerid] = 1;
SendClientMessage(playerid,0x0000D4F6,"Thanks for Buying a Car License.");
return GivePlayerMoney(playerid, -5000);
}
I made the code how I like to make my codes :> Hope you understand how to return a message if player does have a license.
Re: license system -
Mikep - 09.03.2009
How about
pawn Код:
if (gLicenseC[playerid] == 1) return SendClientMessage(playerid,red,"You already have a license!");
?
Re: license system -
MenaceX^ - 09.03.2009
Oh. Probably my code won't do it aswell. Remove the ! infront the gLicenseC[playerid]==true) or just make it as false.
Code re-written.
Re: license system -
thuron - 09.03.2009
thanks articfox, it worked. got it like this now:
Код:
if (strcmp("/buycarlic", cmdtext, true, 10) == 0)
{
if(PlayerToPoint(10.0,playerid,246.5378, 118.0774, 1003.2187))
{
if(5000 > GetPlayerMoney(playerid))
{
SendClientMessage(playerid,0x000087F6,"You Dont have the Money!");
return 1;
}
if (gLicenseC[playerid] == 1)
{
SendClientMessage(playerid,0x000087F6,"You already have a license!");
}
else
{
SendClientMessage(playerid,0x0000D4F6,"Thanks for Buying Car License.");
GivePlayerMoney(playerid, -5000);
}
}
else
{
SendClientMessage(playerid,0x000087F6,"You have to be at the Main Hall to buy a licence!");
}
return 1;
}
Re: license system -
MPKaboose - 09.03.2009
I am happy to hear that