SendClientMessage help
#1

PHP код:
CMD:towcars(playerid,params[])
{
    new 
tId;
    
tId PlayerInfo[playerid][Faction];
    if(
PlayerInfo[playerid][Rank] >=6) {
        for(new 
i=1;i<MAX_VEHICLES;i++)
        {
            
SetVehicleToRespawn(FactionCars[tId][i]);
        }
        
SendFactionMessage(playerid,COLOR_RED"All Faction vehicles have been returned to their places.");
    }
    else
    {
         
SendClientMessage(playerid,COLOR_RED,"You are not a high enough rank.");
    }
    return 
1;

It doesnt send the message All Faction vehicles... it says unknown command after the loop
Reply
#2

Maybe size of variable FactionCars small than MAX_VEHICLES.

FactionCars[tId] >> [i] <<
Reply
#3

the command works just doesnt send the message
Reply
#4

if you mean the SendFactionMessage Doesnt Show IG
then you're gonna have to show us the code for SendFactionMessage
Reply
#5

Yeah... it work, But you told it doesnt send message and say unknow command

That occur because some of above code had error.

Try to show your declare variable FactionCars.
Reply
#6

new FactionCars[MAX_FACTION][MAX_FACTION_CARS];
Reply
#7

What is value of MAX_FACTION_CARS ?

If it less than 2000, Try change it to 2000 or more than, or change some code in cmd.

Код:
for(new i=1;i<MAX_FACTION_CARS;i++)
        {
            SetVehicleToRespawn(FactionCars[tId][i]);
        }
Hope it work.

Bye
Reply
#8

Quote:
Originally Posted by MyLife
Посмотреть сообщение
Yeah... it work, But you told it doesnt send message and say unknow command

That occur because some of above code had error.

Try to show your declare variable FactionCars.
That is why I asked for the code under SendFactionMessage
If it doesn't send the FactionMessage then the bug is probably from there.
Reply
#9

SendFactionMessage shouldn't return a value if you have done.

Edit, hold on:

Why have you done this, and sent it to the "playerid"?

pawn Код:
SendFactionMessage(playerid,COLOR_RED, "All Faction vehicles have been returned to their places.");
Shouldn't it be sending to the "tID"?

pawn Код:
SendFactionMessage(tID,COLOR_RED, "All Faction vehicles have been returned to their places.");
If you send it to the playerid, it will send to the faction ID that's the ID of the player, I mean this:

If the player's ID was 500, it will send to the faction ID of 500.

By all means, I might be wrong because you might be getting the faction ID from the SendFactionMessage, if you are doing, then help us by giving us the SendFactionMessage function so we can check it out.
Reply
#10

pawn Код:
stock IsVehicleOccupied(vehicleid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(!IsPlayerInVehicle(i, vehicleid)) return 1;
        }
    }
    return 0;
}

CMD:towcars(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    for(new v = 0; v < MAX_VEHICLES; v++)
    {
        if(IsVehicleOccupied(v))
        {
            SetVehicleToRespawn(v);
        }
    }
    SendClientMessageToAll(COLOR_WHITE, "Your Message Here");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)