cmd help -
Rabea - 12.01.2015
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.
Re: cmd help -
SWAT4 - 12.01.2015
You Said That It Dosen't Send Message To The Players Who Are In a Plane ,
So What Does It Do Exactly
Re: cmd help -
Ironboy - 12.01.2015
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;
}
Re: cmd help -
Rabea - 12.01.2015
its giving me error, undfined symbol vehicleid
Re: cmd help -
Ironboy - 12.01.2015
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;
}
Re: cmd help -
Rabea - 12.01.2015
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..
Re: cmd help -
Ironboy - 12.01.2015
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;}
Re: cmd help -
Rabea - 12.01.2015
last part for sendplanemessage?