SA-MP Forums Archive
I'm Italian - Help Armour Script - 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: I'm Italian - Help Armour Script (/showthread.php?tid=489608)



I'm Italian - Help Armour Script - Proxysteve - 23.01.2014

Hello, I use this script to spawn armor though I would like to type the command / setarmatura forth the word / setarmatura [playerid] please help
Код HTML:
#define FILTERSCRIPT

#include <a_samp>
#define COLOR_SLATEGRAY 0x708090FF
#define COLOR_LIMEGREEN 0x32CD32FF

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/setarmatura", cmdtext, false) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "Non sei autorizzato a usare questo comando");
        SetPlayerArmour(playerid, 100.0);
        SendClientMessage(playerid, COLOR_LIMEGREEN, "Armatura settata");
        return 1;
    }
    return 0;
}



Re: I'm Italian - Help Armour Script - amirab - 23.01.2014

it works in my script :
PHP код:
if(strcmp(cmdtext,"/setarmatura",true)==0)
{
        if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xFF0000AA"Non sei autorizzato a usare questo comando");
        
SetPlayerArmour(playerid100);
        
SendClientMessage(playeridCOLOR_LIMEGREEN"Armatura settata");
        return 
1;




Re: I'm Italian - Help Armour Script - Kyance - 23.01.2014

Quote:
Originally Posted by amirab
Посмотреть сообщение
it works in my script :
PHP код:
if(strcmp(cmdtext,"/setarmatura",true)==0)
{
        if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xFF0000AA"Non sei autorizzato a usare questo comando");
        
SetPlayerArmour(playerid100);
        
SendClientMessage(playeridCOLOR_LIMEGREEN"Armatura settata");
        return 
1;

He wants a /setarmatura [ID] command.

Anyways, you need sscanf for that:
https://sampforum.blast.hk/showthread.php?tid=120356


Re: I'm Italian - Help Armour Script - PT - 23.01.2014

i used sscanf to do this:

pawn Код:
#include <a_samp>
#include <sscanf2>

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/setarmatura", cmdtext, false) == 0)
    {
        new idplayer;
        if(!IsPlayerAdmin(playerid))
            return SendClientMessage(playerid, 0xFF0000AA, "Non sei autorizzato a usare questo comando");
        if(sscanf(cmdtext, "u", idplayer))
            return SendClientMessage(playerid, 0xFF0000AA, "/setarmatura [playerid]");
        if(!IsPlayerConnected(idplayer))
            return SendClientMessage(playerid, 0xFF0000AA, "id non collegato");
        SetPlayerArmour(idplayer, 100.0);
        SendClientMessage(playerid, 0x32CD32FF, "Armatura settata");
        return 1;
    }
    return 0;
}



Re: I'm Italian - Help Armour Script - ReD_HunTeR - 23.01.2014

Код:
#define FILTERSCRIPT
#include <a_samp>
#define COLOR_SLATEGRAY 0x708090FF
#define COLOR_LIMEGREEN 0x32CD32FF

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/setarmatura", cmdtext, false) == 0)
    {
        new targetid;
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "Non sei autorizzato a usare questo comando");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(player, 0xFF0000AA, "error player not found");
        SetPlayerArmour(targetid, 100.0);
        SendClientMessage(playerid, COLOR_LIMEGREEN, "Armatura settata");
        return 1;
    }
    return 0;
}



Re: I'm Italian - Help Armour Script - Proxysteve - 23.01.2014

Thanks but not function. I try
Код HTML:
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#include <a_samp>
#include <sscanf2>

#else
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/setarmatura", cmdtext, false) == 0)
    {
        new idplayer;
        if(!IsPlayerAdmin(playerid))
            return SendClientMessage(playerid, 0xFF0000AA, "Non sei autorizzato a usare questo comando");
        if(sscanf(cmdtext, "u", idplayer))
            return SendClientMessage(playerid, 0xFF0000AA, "/setarmatura [playerid]");
        if(!IsPlayerConnected(idplayer))
            return SendClientMessage(playerid, 0xFF0000AA, "id non collegato");
        SetPlayerArmour(idplayer, 100.0);
        SendClientMessage(playerid, 0x32CD32FF, "Armatura settata");
        return 1;
    }
    return 0;
}
and your code.

Pawno compiler 0 error but the command not function.


Re: I'm Italian - Help Armour Script - Shetch - 23.01.2014

Did you include the sscanf plugin in your server.cfg file?


Re: I'm Italian - Help Armour Script - Proxysteve - 23.01.2014

Shetch i want write sscanf on line of plugins? Yes but not function, help me please. (I'm italian)


Re: I'm Italian - Help Armour Script - Shetch - 23.01.2014

Quote:
Originally Posted by Proxysteve
Посмотреть сообщение
Shetch i want write sscanf on line of plugins? Yes but not function, help me please. (I'm italian)
Sorry dude, I'm having a bad time understanding you.
One thing is for sure, you're Italian.


Re: I'm Italian - Help Armour Script - Proxysteve - 23.01.2014

Shetch, you give me the working code?