Need help. - 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)
+--- Thread: Need help. (
/showthread.php?tid=485713)
Need help. -
GrandParadise - 05.01.2014
How can i make that only players with the [GD] tag on their name are able to use this command?
Код:
CMD:sellak(playerid, params[])
{
new playerb, bullets, string[128];
new Skin;
Skin = GetPlayerSkin(playerid);
if(Skin == 6||Skin == 176||Skin == 29||Skin ==28||Skin ==24||Skin ==233||Skin ==180)
if(!IsPlayerInRangeOfPoint(playerid,7, 1397.20117188, -1897.06628418, 12.71907330)) return SendClientMessage(playerid,-1,"You are not at the right place!");
if(sscanf(params,"ii",playerb,bullets)) return SendClientMessage(playerid,-1,"Usage: /sellak [id] [ammo]");
if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid,-1,"You are too far away from that player!");
if(bullets < 1 || bullets > 400) return SendClientMessage(playerid, 0xFF9900AA, "You can only take 1-400 bullets at once!");
format(string, sizeof(string), "** %s takes out a AK-47 and a box of ammo as he passes it to %s", NAMEGET(playerid), NAMEGET(playerb), bullets);
NearMessageSender(playerid, 7, string, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
format(string, sizeof(string), "Gun Dealer %s has given you a AK-47 and a box of ammo.", NAMEGET(playerid));
SendClientMessage(playerb, COLOR_RED, string);
GivePlayerWeapon(playerb, 30, bullets);
GivePlayerMoney(playerid, -200);//you can change the ammount of money taken from the player
return 1;
}
Re: Need help. -
mxstr - 05.01.2014
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
if(strfind(name, "[GD]", true) != -1)
{
...
}
Re: Need help. -
MatriXgaMer - 05.01.2014
pawn Код:
CMD:sellak(playerid, params[])
{
new playerb, bullets, string[128], igrac[MAX_PLAYER_NAME], target[MAX_PLAYER_NAME]
GetPlayerName(playerid, igrac, sizeof(igrac));
GetPlayerName(targetid, target, sizeof(target));
new Skin;
Skin = GetPlayerSkin(playerid);
if(Skin == 6||Skin == 176||Skin == 29||Skin ==28||Skin ==24||Skin ==233||Skin ==180)
if(!IsPlayerInRangeOfPoint(playerid,7, 1397.20117188, -1897.06628418, 12.71907330)) return SendClientMessage(playerid,-1,"You are not at the right place!");
if(sscanf(params,"ii",playerb,bullets)) return SendClientMessage(playerid,-1,"Usage: /sellak [id] [ammo]");
if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid,-1,"You are too far away from that player!");
if(bullets < 1 || bullets > 400) return SendClientMessage(playerid, 0xFF9900AA, "You can only take 1-400 bullets at once!");
format(string, sizeof(string), "** %s takes out a AK-47 and a box of ammo as he passes it to %s", igrac, target, bullets);
NearMessageSender(playerid, 7, string, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
format(string, sizeof(string), "Gun Dealer %s has given you a AK-47 and a box of ammo.", igrac);
SendClientMessage(target, COLOR_RED, string);
GivePlayerWeapon(target, 30, bullets);
GivePlayerMoney(playerid, -200);//you can change the ammount of money taken from the player
return 1;
}