SA-MP Forums Archive
SendClientMessage help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SendClientMessage help (/showthread.php?tid=474572)



SendClientMessage help - lramos15 - 08.11.2013

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


Re: SendClientMessage help - MyLife - 08.11.2013

Maybe size of variable FactionCars small than MAX_VEHICLES.

FactionCars[tId] >> [i] <<


Re: SendClientMessage help - lramos15 - 08.11.2013

the command works just doesnt send the message


Re: SendClientMessage help - Elie1996 - 08.11.2013

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


Re: SendClientMessage help - MyLife - 08.11.2013

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.


Re: SendClientMessage help - lramos15 - 08.11.2013

new FactionCars[MAX_FACTION][MAX_FACTION_CARS];


Re: SendClientMessage help - MyLife - 08.11.2013

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


Re: SendClientMessage help - Elie1996 - 08.11.2013

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.


Re: SendClientMessage help - DanishHaq - 08.11.2013

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.


Re: SendClientMessage help - AnonScripter - 08.11.2013

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;
}