ZCMD goes wrong..
#1

I remade spec command to DCMD..
InGame - when i type /spec it wants to spec playerid who typed it, but i need to show the usage "Lietojums:"
pawn Код:
CMD:spec(playerid, params[])
{
    new playa, Name[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME],String[64];
    if (PlayerInfo[playerid][pAdmin] >= 1)
    {
        if(!sscanf(params,"u",playa))
        {
            if(IsPlayerConnected(playa))
            {
                if(playa == playerid){SendClientMessage(playerid,COLOR_RED,"Nevar novērot pats sevi!"); return 1;}
                if(Specing[playa] == 1)
                {SendClientMessage(playerid,COLOR_RED,"Spēlētājs kādu novēro, nevar novērot viņu, kamēr viņљ novēro!"); return 1;}
                GetPlayerName(playerid, Name, sizeof(Name));
                GetPlayerName(playa, Name2, sizeof(Name2));
                format(String, sizeof(String), "[%i] %s is now spectating [%i] %s",playerid, Name,playa, Name2);
                CallLocalFunction("ircRemoteSay", "iss", 1, "#FSE", String);
                Specing[playerid] = 1;
                if(!IsPlayerInAnyVehicle(playa))
                {
                    TogglePlayerSpectating(playerid, 1);
                    PlayerSpectatePlayer(playerid, playa);
                    SetPlayerInterior(playerid,GetPlayerInterior(playa));
                    SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playa));
                    return 1;
                }
                else
                {
                    TogglePlayerSpectating(playerid, 1);
                    PlayerSpectateVehicle(playerid, GetPlayerVehicleID(playa));
                    SetPlayerInterior(playerid,GetPlayerInterior(playa));
                    SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playa));
                    return 1;
                }
            }
            else {SendClientMessage(playerid,COLOR_GREY,"Spēlētājs ar tādu id neeksistē!");return 1;}
        }
        else {SendClientMessage(playerid,COLOR_GREY,"Lietojums: /spec <Spēlētāja ID>");return 1;}
    }
    else {SendClientMessage(playerid,COLOR_GREY,"Tu nevari lietot љo komandu!");return 1;}
}
Reply
#2

pawn Код:
CMD:spec(playerid, params[])
{
    new playa, Name[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME],String[64];
    if (PlayerInfo[playerid][pAdmin] >= 1)
    {
        if(!sscanf(params,"u",playa)) SendClientMessage(playerid,COLOR_GREY,"Lietojums: /spec <SpēlētājaID>");
        else
        {
            if(IsPlayerConnected(playa))
            {
                if(playa == playerid){SendClientMessage(playerid,COLOR_RED,"Nevar novērot pats sevi!"); return 1;}
                if(Specing[playa] == 1)
                {SendClientMessage(playerid,COLOR_RED,"Spēlētājs kādu novēro, nevar novērot viņu, kamēr viņљ novēro!"); return 1;}
                GetPlayerName(playerid, Name, sizeof(Name));
                GetPlayerName(playa, Name2, sizeof(Name2));
                format(String, sizeof(String), "[%i] %s is now spectating [%i] %s",playerid, Name,playa, Name2);
                CallLocalFunction("ircRemoteSay", "iss", 1, "#FSE", String);
                Specing[playerid] = 1;
                if(!IsPlayerInAnyVehicle(playa))
                {
                    TogglePlayerSpectating(playerid, 1);
                    PlayerSpectatePlayer(playerid, playa);
                    SetPlayerInterior(playerid,GetPlayerInterior(playa));
                    SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playa));
                    return 1;
                }
                else
                {
                    TogglePlayerSpectating(playerid, 1);
                    PlayerSpectateVehicle(playerid, GetPlayerVehicleID(playa));
                    SetPlayerInterior(playerid,GetPlayerInterior(playa));
                    SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playa));
                    return 1;
                }
            }
            else {SendClientMessage(playerid,COLOR_GREY,"Spēlētājs ar tādu id neeksistē!");return 1;}
        }
    }
    else {SendClientMessage(playerid,COLOR_GREY,"Tu nevari lietot љo komandu!");return 1;}
}
Reply
#3

ok tnx.. wokr

Another question..

I have looked in animations list...

Is there any animatiof for DJ?
Like scratching etc..
Reply
#4

Can't help on that, Not very experienced with animations
Reply
#5

Why you do
Код:
if(IsPlayerConnected(playa))
and not
Код:
if(playa != INVALID_PLAYER_ID)
?
Reply
#6

Ahm because there something messed up with that when i used it..

anyway returning to ZCMD..

when i write my zcmd
it dones perfectly, but when command is done it shows that is unknown command.. I am using return 1 at the end of the ZCMD... looks like this..

pawn Код:
CMD:givemoney(playerid,params[])
{
    if(IsPlayerConnected(playerid))
    {
        new playa,money,string[64],sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME],tmp[256];
        if(PlayerInfo[playerid][pAdmin] >= 1338)
        {
            money = strval(tmp);
            if(sscanf(params, "ui", playa,money))
            {SendClientMessage(playerid,COLOR_GREY,"Lietojums: /givemoney <Spēlētāja ID> <Naudas Daudzums>");return 1;}
            if(IsPlayerConnected(playa))
            {
                PlayerInfo[playa][pMoneyH] += money;
                GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, 256, "AdmWarning: Administrators %s iedeva %s $%d.", sendername,giveplayer,money);
                ABroadCast(COLOR_YELLOW,string,1);
            }
            else {SendClientMessage(playerid,COLOR_GREY,"Nepareizs spēlētāja ID");}
        }
        else{SendClientMessage(playerid,COLOR_GREY,"Tu nevari izmantot љo komandu!");}
    }
    return 1;
}
Reply
#7

invalid_playerid_id is better cus ifisplayerconnect doesnt work for ID 0 so when u do invalid etc. it returns message for id 0 if u have one ifplayerisconnected crashes u<.< well My server L
Reply
#8

ok changed to that.. but what about that unknown command?

It shows up if command was successfull...
Reply
#9

Should fix it...

pawn Код:
CMD:givemoney(playerid,params[])
{
    if(IsPlayerConnected(playerid))
    {
        new playa,money,string[64],sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME],tmp[256];
        if(PlayerInfo[playerid][pAdmin] >= 1338)
        {
            money = strval(tmp);
            if(sscanf(params, "ui", playa,money)) return SendClientMessage(playerid,COLOR_GREY,"Lietojums: /givemoney <Spe-le-ta-ja ID> <Naudas Daudzums>");
            if(IsPlayerConnected(playa))
            {
                PlayerInfo[playa][pMoneyH] += money;
                GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, 256, "AdmWarning: Administrators %s iedeva %s $%d.", sendername,giveplayer,money);
                ABroadCast(COLOR_YELLOW,string,1);
            }
            else return SendClientMessage(playerid,COLOR_GREY,"Nepareizs spe-le-ta-ja ID");
        }
        else return SendClientMessage(playerid,COLOR_GREY,"Tu nevari izmantot љo komandu!");
    }
    return 1;
}
Reply
#10

The same... ;(

These elses works fine.. but when comand dones..
gives the money shos strings/messages etcc after that all it shows SERVER:Uncnown command, but commands dones it work perfect.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)