SA-MP Forums Archive
giving gun problem - 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: giving gun problem (/showthread.php?tid=368054)



giving gun problem - Jermi - 12.08.2012

Hello Guys

First I need to full command of giving gun like

"/sellgun (id) (weaponid)"

Please give me full codes and i will rep you for it


Re: giving gun problem - Richard Steinheimer - 12.08.2012

What type of command format are you using? ZCMD, DCMD, or just regular Command Format?


Re: giving gun problem - Jermi - 12.08.2012

ZCMD @RICHARD


Re: giving gun problem - Richard Steinheimer - 12.08.2012

Enjoy! I just got done making your command. (:
Код:
CMD:sellgun(playerid, params[])
{
    new otherid, weaponName;
    new string[64], PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    SendClientMessage(playerid, COLOR_WHITE, "--------------------------------[Guns You Can Sell]--------------------------------");
    SendClientMessage(playerid, COLOR_WHITE, "Level 1: Bat(A-200) | Cane(A-200) | Flowers(A-50) | Katana(A-200) | SDPistol(A-250)");
    SendClientMessage(playerid, COLOR_WHITE, "--------------------------------[Guns You Can Sell]--------------------------------");
    else if(otherid == INVALID_PLAYER_ID) return SendClientMessage(playerid, CHAT_COLOR_RED, "SERVER: Uknown Player ID.");
    else
    {
	if(strcmp(params, "Bat", true, 3))
	{
	     GivePlayerWeapon(otherid, 5, 1);
             SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Bat works.");
        }
        else if(strcmp(params, "Cane", true, 4))
        {
             GivePlayerWeapon(otherid, 15, 1);
             SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Cane works.");
        }
        else if(strcmp(params, "Flowers", true, 7))
        {
             GivePlayerWeapon(otherid, 14, 1);
             SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Flowers works.");
        }
        else if(strcmp(params, "Katana", true, 6))
   	{
             GivePlayerWeapon(otherid, 8, 1);
             SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Katana works.");
       	}
        else if(strcmp(params, "SDPistol", true, 8))
        {
             GivePlayerWeapon(otherid, 23, 10000);
             SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "SDPistol works.");
     	}
    }
    return 1;
}



Re: giving gun problem - Jermi - 12.08.2012

Thanks and Reped but do i need to define the Chat_Colors ?


Re: giving gun problem - Jermi - 12.08.2012

The problem is in this line?

Quote:

else if(otherid == INVALID_PLAYER_ID) return SendClientMessage(playerid, CHAT_COLOR_RED, "SERVER: Uknown Player ID.")

;

Quote:

:\Gta San Andreas\Gta San Andreas\Gta San Andreas\Jermi\gamemodes\Gangsta.pwn(622) : error 029: invalid expression, assumed zero
L:\Gta San Andreas\Gta San Andreas\Gta San Andreas\Jermi\gamemodes\Gangsta.pwn(622) : warning 215: expression has no effect
L:\Gta San Andreas\Gta San Andreas\Gta San Andreas\Jermi\gamemodes\Gangsta.pwn(622) : error 001: expected token: ";", but found "if"
L:\Gta San Andreas\Gta San Andreas\Gta San Andreas\Jermi\gamemodes\Gangsta.pwn(622) : error 017: undefined symbol "CHAT_COLOR_RED"
L:\Gta San Andreas\Gta San Andreas\Gta San Andreas\Jermi\gamemodes\Gangsta.pwn(622) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.




Re: giving gun problem - [DM]Kane - 12.08.2012

#define CHAT_COLOR_RED #FF0000
at the top of your script, along with other defines.


Re: giving gun problem - Jermi - 12.08.2012

So ? help?


Re: giving gun problem - [DM]Kane - 12.08.2012

Add that to your script and it should help.


Re: giving gun problem - Jermi - 12.08.2012

oh, Color define works but Still the errors but chat color is fixed