I'm Italian - Help Armour Script
#1

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

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;

Reply
#3

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

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

Код:
#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;
}
Reply
#6

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

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

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

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

Shetch, you give me the working code?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)