SA-MP Forums Archive
Problem.. [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: Problem.. [help] (/showthread.php?tid=425224)



Problem.. [help] - Nivniv2 - 25.03.2013

Код:
CMD:giveweapontoy(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1337)
    {
        new string[128], giveplayerid, object, slot;
        if(sscanf(params, "udd", giveplayerid, object, slot)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /giveweapontoy [playerid] [number] [slot]");
            SendClientMessageEx(playerid, COLOR_WHITE, "339 Katana 346 9mm 347 SDPistol");
            SendClientMessageEx(playerid, COLOR_WHITE, "348 Deagle 349 Shotgun 351 Spas");
            SendClientMessageEx(playerid, COLOR_WHITE, "352 Micro Uzi 353 MP5 355 AK");
            SendClientMessageEx(playerid, COLOR_WHITE, "356 M4 358 Sniper");

        if(slot < 0 || slot > 5) return SendClientMessageEx(playerid, COLOR_WHITE, "* Invalid slot, must be between 0 and 5");
        if( (object > 335 && object < 335) || (object > 339 && object < 339) || (object > 346 && object < 346) ||
        (object > 347 && object < 347) || (object > 348 && object < 348) || (object > 349 && object < 349) || (object > 351 && object < 351) || (object && 352 || object && 352) || (object > 353 && object < 353)  || (object > 356 && object < 356) || object == 358 || object == 358)
	    {
            if (IsPlayerConnected(giveplayerid))
            {
                PlayerToyInfo[giveplayerid][slot][ptModelID] = object;
                PlayerToyInfo[giveplayerid][slot][ptBone] = 1;
                format(string, sizeof(string), "You have given %s weapon toy %d in slot %d", GetPlayerNameEx(giveplayerid), object, slot);
                SendClientMessageEx(playerid, COLOR_YELLOW, string);
                SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have received a new /toys from an administrator!");
            }
        }
        else
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "* Invalid object");
        }
    }
    return 1;
}
When i write /giveweapontoy its only shows this:

Код:
USAGE: /giveweapontoy [playerid] [number] [slot]
But not this:

Код:
USAGE: /giveweapontoy [playerid] [number] [slot]
339 Katana 346 9mm 347 SDPistol
348 Deagle 349 Shotgun 351 Spas
352 Micro Uzi 353 MP5 355 AK
356 M4 358 Sniper



Re: Problem.. [help] - Nivniv2 - 25.03.2013

Help?


Re: Problem.. [help] - Nivniv2 - 25.03.2013

Someone?


Re: Problem.. [help] - Nivniv2 - 25.03.2013

Someone?


Re: Problem.. [help] - Avi Raj - 25.03.2013

Код:
CMD:giveweapontoy(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1337)
    {
        new string[128], giveplayerid, object, slot;
        if(sscanf(params, "udd", giveplayerid, object, slot)) 
        SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /giveweapontoy [playerid] [number] [slot]");
        SendClientMessageEx(playerid, COLOR_WHITE, "339 Katana 346 9mm 347 SDPistol");
        SendClientMessageEx(playerid, COLOR_WHITE, "348 Deagle 349 Shotgun 351 Spas");
        SendClientMessageEx(playerid, COLOR_WHITE, "352 Micro Uzi 353 MP5 355 AK");
        SendClientMessageEx(playerid, COLOR_WHITE, "356 M4 358 Sniper");

        if(slot < 0 || slot > 5) return SendClientMessageEx(playerid, COLOR_WHITE, "* Invalid slot, must be between 0 and 5");
        if( (object > 335 && object < 335) || (object > 339 && object < 339) || (object > 346 && object < 346) ||
        (object > 347 && object < 347) || (object > 348 && object < 348) || (object > 349 && object < 349) || (object > 351 && object < 351) || (object && 352 || object && 352) || (object > 353 && object < 353)  || (object > 356 && object < 356) || object == 358 || object == 358)
	    {
            if (IsPlayerConnected(giveplayerid))
            {
                PlayerToyInfo[giveplayerid][slot][ptModelID] = object;
                PlayerToyInfo[giveplayerid][slot][ptBone] = 1;
                format(string, sizeof(string), "You have given %s weapon toy %d in slot %d", GetPlayerNameEx(giveplayerid), object, slot);
                SendClientMessageEx(playerid, COLOR_YELLOW, string);
                SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have received a new /toys from an administrator!");
            }
        }
        else
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "* Invalid object");
        }
    }
    return 1;
}



Re: Problem.. [help] - Dubya - 25.03.2013

Quote:
Originally Posted by Thour57
Посмотреть сообщение
Код:
CMD:giveweapontoy(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1337)
    {
        new string[128], giveplayerid, object, slot;
        if(sscanf(params, "udd", giveplayerid, object, slot)) 
        SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /giveweapontoy [playerid] [number] [slot]");
        SendClientMessageEx(playerid, COLOR_WHITE, "339 Katana 346 9mm 347 SDPistol");
        SendClientMessageEx(playerid, COLOR_WHITE, "348 Deagle 349 Shotgun 351 Spas");
        SendClientMessageEx(playerid, COLOR_WHITE, "352 Micro Uzi 353 MP5 355 AK");
        SendClientMessageEx(playerid, COLOR_WHITE, "356 M4 358 Sniper");

        if(slot < 0 || slot > 5) return SendClientMessageEx(playerid, COLOR_WHITE, "* Invalid slot, must be between 0 and 5");
        if( (object > 335 && object < 335) || (object > 339 && object < 339) || (object > 346 && object < 346) ||
        (object > 347 && object < 347) || (object > 348 && object < 348) || (object > 349 && object < 349) || (object > 351 && object < 351) || (object && 352 || object && 352) || (object > 353 && object < 353)  || (object > 356 && object < 356) || object == 358 || object == 358)
	    {
            if (IsPlayerConnected(giveplayerid))
            {
                PlayerToyInfo[giveplayerid][slot][ptModelID] = object;
                PlayerToyInfo[giveplayerid][slot][ptBone] = 1;
                format(string, sizeof(string), "You have given %s weapon toy %d in slot %d", GetPlayerNameEx(giveplayerid), object, slot);
                SendClientMessageEx(playerid, COLOR_YELLOW, string);
                SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have received a new /toys from an administrator!");
            }
        }
        else
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "* Invalid object");
        }
    }
    return 1;
}
That won't work.
Try this:
pawn Код:
CMD:giveweapontoy(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1337)
    {
        new string[128], giveplayerid, object, slot;
        if(sscanf(params, "udd", giveplayerid, object, slot))
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /giveweapontoy [playerid] [number] [slot]");
            SendClientMessageEx(playerid, COLOR_WHITE, "339 Katana 346 9mm 347 SDPistol");
            SendClientMessageEx(playerid, COLOR_WHITE, "348 Deagle 349 Shotgun 351 Spas");
            SendClientMessageEx(playerid, COLOR_WHITE, "352 Micro Uzi 353 MP5 355 AK");
            SendClientMessageEx(playerid, COLOR_WHITE, "356 M4 358 Sniper");
            return 1;
        }
        if(slot < 0 || slot > 5) return SendClientMessageEx(playerid, COLOR_WHITE, "* Invalid slot, must be between 0 and 5");
        if( (object > 335 && object < 335) || (object > 339 && object < 339) || (object > 346 && object < 346) ||
        (object > 347 && object < 347) || (object > 348 && object < 348) || (object > 349 && object < 349) || (object > 351 && object < 351) || (object && 352 || object && 352) || (object > 353 && object < 353)  || (object > 356 && object < 356) || object == 358 || object == 358)
        {
            if (IsPlayerConnected(giveplayerid))
            {
                PlayerToyInfo[giveplayerid][slot][ptModelID] = object;
                PlayerToyInfo[giveplayerid][slot][ptBone] = 1;
                format(string, sizeof(string), "You have given %s weapon toy %d in slot %d", GetPlayerNameEx(giveplayerid), object, slot);
                SendClientMessageEx(playerid, COLOR_YELLOW, string);
                SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have received a new /toys from an administrator!");
            }
        }
        else
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "* Invalid object");
        }
    }
    return 1;
}