Necesito estos comandos:..
#7

pawn Код:
// al principio de tu script

#define COLOR_WHITE 0xFFFFFAA

new aWeaponNames[][32] = {
    {"Unarmed (Fist)"}, // 0
    {"Brass Knuckles"}, // 1
    {"Golf Club"}, // 2
    {"Night Stick"}, // 3
    {"Knife"}, // 4
    {"Baseball Bat"}, // 5
    {"Shovel"}, // 6
    {"Pool Cue"}, // 7
    {"Katana"}, // 8
    {"Chainsaw"}, // 9
    {"Purple Dildo"}, // 10
    {"Big White Vibrator"}, // 11
    {"Medium White Vibrator"}, // 12
    {"Small White Vibrator"}, // 13
    {"Flowers"}, // 14
    {"Cane"}, // 15
    {"Grenade"}, // 16
    {"Teargas"}, // 17
    {"Molotov"}, // 18
    {" "}, // 19
    {" "}, // 20
    {" "}, // 21
    {"Colt 45"}, // 22
    {"Colt 45 (Silenced)"}, // 23
    {"Desert Eagle"}, // 24
    {"Normal Shotgun"}, // 25
    {"Sawnoff Shotgun"}, // 26
    {"Combat Shotgun"}, // 27
    {"Micro Uzi (Mac 10)"}, // 28
    {"MP5"}, // 29
    {"AK47"}, // 30
    {"M4"}, // 31
    {"Tec9"}, // 32
    {"Country Rifle"}, // 33
    {"Sniper Rifle"}, // 34
    {"Rocket Launcher"}, // 35
    {"Heat-Seeking Rocket Launcher"}, // 36
    {"Flamethrower"}, // 37
    {"Minigun"}, // 38
    {"Satchel Charge"}, // 39
    {"Detonator"}, // 40
    {"Spray Can"}, // 41
    {"Fire Extinguisher"}, // 42
    {"Camera"}, // 43
    {"Night Vision Goggles"}, // 44
    {"Infrared Vision Goggles"}, // 45
    {"Parachute"}, // 46
    {"Fake Pistol"} // 47
};


 // en cualquier parte
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
 
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

GetWeaponModelIDFromName(wname[])
{
  for(new i = 0; i < 48; i++) {
    if (i == 19 || i == 20 || i == 21) continue;
        if (strfind(aWeaponNames[i], wname, true) != -1) {
            return i;
        }
    }
    return -1;
}

// en OnPlayerCommandText

public OnPlayerCommandText(playerid,cmdtext[])
{
    new cmd[256],
        idx = 0;

    cmd = strtok( cmdtext , idx );

    if( strcmp( cmd, "/arma" , true ) == 0 )
    {
        new nombre_arma[128];
       
        nombre_arma = strtok( cmdtext , idx );
       
        if( strlen( nombre_arma ) == 0 )
        {
            SendClientMessage( playerid , COLOR_WHITE , "USO CORRECTO: /arma [nombre]" );
            return 1;
        }
       
        GivePlayerWeapon( playerid , GetWeaponModelIDFromName( nombre_arma ) );
       
        return 1;
    }
}
Ahi tienes , suerte!
Lo mejor es que trates de entender como funciona , para poder mбs adelante lograr las cosas por ti mismo
Reply


Messages In This Thread
Necesito estos comandos:.. - by Haydoon - 04.01.2010, 18:52
Re: Necesito estos comandos:.. - by Zamaroht - 04.01.2010, 19:18
Re: Necesito estos comandos:.. - by iywe - 04.01.2010, 20:18
Re: Necesito estos comandos:.. - by Haydoon - 04.01.2010, 20:46
Re: Necesito estos comandos:.. - by Miguel - 05.01.2010, 03:29
Re: Necesito estos comandos:.. - by Roymer - 05.01.2010, 03:36
Re: Necesito estos comandos:.. - by SpitxFirew - 05.01.2010, 04:46
Re: Necesito estos comandos:.. - by Haydoon - 05.01.2010, 08:06
Re: Necesito estos comandos:.. - by Miguel - 05.01.2010, 13:27
Re: Necesito estos comandos:.. - by Haydoon - 05.01.2010, 14:02

Forum Jump:


Users browsing this thread: 1 Guest(s)