Gun system dcmd -
xir - 06.01.2011
I need help with my gun system, this one sucks.. and all messed up, i need help to a better code
pawn Код:
dcmd_gun 24(playerid, params[])
{
if(sscanf(params, "d", pid)) return SendClientMessage(playerid, Yellow,"Usage: /gun <id> (24-34)");
SendClientMessage(playerid, Green, "You equipped Desert Eagle");
GivePlayerWeapon(playerid, 24, 1500);
return 1;
}
and i have dcmd gun 24,25,26,27 etc all the way up to 34 and it just gives error and stuff.. so please help
Re: Gun system dcmd -
Kwarde - 06.01.2011
Quote:
dcmd_gun 24(playerid, params[])
|
Don't use spaces in the command names. For params use sscanf.
Код:
dcmd_gun(playerid, params[])
Re: Gun system dcmd -
xir - 06.01.2011
Could you make like gun id 24,25,26 then i can do the rest, i just need to see how you do it
Re: Gun system dcmd -
Kwarde - 06.01.2011
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(gun, 3, cmdtext);
return 1;
}
dcmd_gun(playerid, params[])
{
new gunid, str[128];
if(sscanf(params, "d", gunid)) return SendClientMessage(playerid, Yellow, "USAGE: /gun <id> (24-34)");
if(gunid < 24 || gunid > 34) return SendClientMessage(playerid, Yellow, "ERROR! Wrong gun ID! (24-34)");
format(str, 128, "You bought an gun! (ID: %d)", gunid);
SendClientMessage(playerid, Green, str);
GivePlayerWeapon(playerid, gunid, 1500);
return 1;
}
It are all the gun ID's xD - 24 - 34
Re: Gun system dcmd -
xir - 06.01.2011
nice
oke just one question
this
pawn Код:
format(str, 128, "You equipped Desert Eagle ! ( ID: %d )", gunid);
I want it to say the name also, how can i add the gun name too ?
Re: Gun system dcmd -
Kwarde - 06.01.2011
pawn Код:
stock GetGunName(gunid, output[], len[])
{
switch(gunid){
case 0: return format(output, len, "Fists");
case 1: return format(output, len, "Brass Knuckles");
}
return 0;
}
edit that thing yourself with all ID's. Try that. usage:
pawn Код:
new gunname[50];
GetGunName(gunid, gunname, 50);
format(str, 128, "You equpped an %s (%d)", gunname, gunid);
idk if it's gonna work. Just try it. I gotta go now. Can't help you no more.
Here are all the gun names + ID:
http://weedarr.wikidot.com/gunlist
Re: Gun system dcmd -
bartje01 - 06.01.2011
NVM already posted
Re: Gun system dcmd -
Kwarde - 06.01.2011
Omg make your own scripts if you announce them, or give them credits.
'GetVehicleModel(vehicleid) - 400' ??
Probably from a gm/fs from SA:MP itself. And he wanted an client messsage, not the gametext
Re: Gun system dcmd -
Kyle_Olsen - 06.01.2011
Quote:
Originally Posted by Kwarde
pawn Код:
stock GetGunName(gunid, output[], len[]) { switch(gunid){ case 0: return format(output, len, "Fists"); case 1: return format(output, len, "Brass Knuckles"); } return 0; }
edit that thing yourself with all ID's. Try that. usage:
pawn Код:
new gunname[50]; GetGunName(gunid, gunname, 50); format(str, 128, "You equpped an %s (%d)", gunname, gunid);
idk if it's gonna work. Just try it. I gotta go now. Can't help you no more.
Here are all the gun names + ID: http://weedarr.wikidot.com/gunlist
|
Better: Use the native GetWeaponName function.
https://sampwiki.blast.hk/wiki/GetWeaponName
Re: Gun system dcmd -
Kwarde - 07.01.2011
Quote:
Originally Posted by Kyle_Olsen
|
Quote:
Originally Posted by WIKI
Returns null for ids: 18, 44 and 45.
|
Molotov, Thermal & Night Vision return's null. This one not