CMD: to strcmp ?
#1

Hy guys, can someone help me with this command , i use strcmp .. and i tried to make it to strcmp but i failed ..

pawn Код:
CMD:radar(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new sendername[MAX_PLAYER_NAME];
        new giveplayer[MAX_PLAYER_NAME];
        new string[128];
        if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1)
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            sendername[strfind(sendername,"_")] = ' ';
            format(string, sizeof(string), "* %s takes out a speed radar and shoots it out.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            SendClientMessage(playerid, COLOR_GREEN, "Nearest vehicles speed:");
            for(new i=0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i) && i!=playerid)
                {
                    if(IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
                    {
                        if (ProxDetectorS(30.0, playerid, i) && Speed[i] > 15)
                        {
                            GetPlayerName(i, giveplayer, sizeof(giveplayer));
                            giveplayer[strfind(giveplayer,"_")] = ' ';
                            format(string, sizeof(string), "Vehicle:%s Name:%s speed ~%dkm/h", VehicleNames[GetVehicleModel(GetPlayerVehicleID(i))-400],giveplayer,Speed[i]);
                            SendClientMessage(playerid, COLOR_YELLOW, string);
                        }
                    }
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "* You are not a cop!");
            return 1;
        }
        return 1;
    }
    return 1;
}
Reply
#2

Why would you degrade it?
Reply
#3

Quote:
Originally Posted by blank.
Посмотреть сообщение
Why would you degrade it?
I don't understand what are u try to say, i just want to make the command for strcmp because with CMD: i can't use it.
Reply
#4

he means that useing strcmp over a command processor is degrading it,

look up ZCMD or YCMD or DCMD they are very very easy to use
and make writing commands so much easier!

I use YCMD and many others ZCMD i think dcmd is old and slow too.
Reply
#5

Yes, but i need it for strcmp ? can some one help?
Reply
#6

pawn Код:
CMD:radar(playerid, params[])
{
replace that with

pawn Код:
if (strcmp("/radar", cmdtext, true, 6) == 0)
{
But i think it wont work because you dont use

pawn Код:
PlayerInfo[playerid][pLeader]
PlayerInfo[playerid][pMember]
ProxDetector
VehicleNames[GetVehicleModel(GetPlayerVehicleID(i)) // Easy to fix
Reply
#7

Quote:
Originally Posted by sjvt
Посмотреть сообщение
pawn Код:
CMD:radar(playerid, params[])
{
replace that with

pawn Код:
if (strcmp("/radar", cmdtext, true, 6) == 0)
{
But i think it wont work because you dont use

pawn Код:
PlayerInfo[playerid][pLeader]
PlayerInfo[playerid][pMember]
ProxDetector
VehicleNames[GetVehicleModel(GetPlayerVehicleID(i)) // Easy to fix
I tried like u sayd, but when i type /radar i get "SERVER: Unknown Command"
Reply
#8

Because you didn't put it between
pawn Код:
public OnPlayerCommandText(playerid, cmdtext)
{
and
pawn Код:
return 1;
}
Reply
#9

Quote:
Originally Posted by sjvt
Посмотреть сообщение
Because you didn't put it between
pawn Код:
public OnPlayerCommandText(playerid, cmdtext)
{
and
pawn Код:
return 1;
}
The same .. "SERVER: Unknown Command"
Reply
#10

send code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)