cmd help
#1

what is wrong with this command?
pawn Код:
CMD:pilotradio(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pilotradio [text]");
    else format(string, sizeof(string), "(( %s: %s ))", NORPN(playerid), params);
    SendPlaneMessage(COLOR_GREEN, string);
    return 1;
}
pawn Код:
stock SendPlaneMessage(color, string[])
{
        new carid = GetVehicleModel(carid);
        new playerid;
    foreach(Player, i)
    {
        if(IsPlayerLoggedIn(i) && IsModelAPlane(carid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            SendClientMessage(i, color, string);
        }
    }
        return 1;
}
it dosen't send message to the players who is in a plane.
Thanks for helping.
Reply
#2

You Said That It Dosen't Send Message To The Players Who Are In a Plane ,
So What Does It Do Exactly
Reply
#3

Try this

pawn Код:
stock SendPlaneMessage(color, string[])
{
    new carid = GetVehicleModel(vehicleid);
    //new playerid;
    foreach(Player, i)
    {
        if(IsPlayerLoggedIn(i) && IsModelAPlane(carid) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            SendClientMessage(i, color, string);
        }
    }
    return 1;
}
Reply
#4

its giving me error, undfined symbol vehicleid
Reply
#5

Quote:
Originally Posted by Rabea
Посмотреть сообщение
its giving me error, undfined symbol vehicleid
pawn Код:
stock SendPlaneMessage(color, string[])
{
    new playerid;
    new carid = GetPlayerVehicleID(playerid);
    foreach(Player, i)
    {
        if(IsPlayerLoggedIn(i) && IsModelAPlane(carid) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            SendClientMessage(i, color, string);
        }
    }
    return 1;
}
Reply
#6

pawn Код:
CMD:pilotradio(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pilotradio [text]");
    else format(string, sizeof(string), "(( %s: %s ))", NORPN(playerid), params);
    SendPlaneMessage(COLOR_GREEN, string);
    return 1;
}
i can't see what i'm writing why..
Reply
#7

Quote:
Originally Posted by Rabea
Посмотреть сообщение
[PAWN]
i can't see what i'm writing why..
Try the simplest way

pawn Код:
CMD:pilotradio(playerid,params[]) {
    #pragma unused params
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /pilotradio [text]");
    new string[256], pname[MAX_PLAYER_NAME];
    format(string, sizeof(string), "(( %s: %s ))", pname, params[0] );
    new carid = GetPlayerVehicleID(playerid);
    foreach(Player, i)
    {
        if(IsPlayerLoggedIn(i) && IsModelAPlane(carid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            SendClientMessage(i, -1, string);
        }
    }
    return 1;}
Reply
#8

last part for sendplanemessage?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)