Gun system dcmd
#1

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
Reply
#2

Quote:

dcmd_gun 24(playerid, params[])

Don't use spaces in the command names. For params use sscanf.

Код:
dcmd_gun(playerid, params[])
Reply
#3

Could you make like gun id 24,25,26 then i can do the rest, i just need to see how you do it
Reply
#4

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
Reply
#5

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 ?
Reply
#6

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
Reply
#7

NVM already posted
Reply
#8

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
Reply
#9

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
Reply
#10

Quote:
Originally Posted by Kyle_Olsen
Посмотреть сообщение
Better: Use the native GetWeaponName function. https://sampwiki.blast.hk/wiki/GetWeaponName
Quote:
Originally Posted by WIKI
Returns null for ids: 18, 44 and 45.
Molotov, Thermal & Night Vision return's null. This one not
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)