Problem with car respawn
#1

here is the command:
PHP код:
     if(strcmp(cmd"/respawnallcars"true) == || strcmp(cmd"/rac"true) == 0// by MK
    
{
      if(
IsPlayerConnected(playerid))
      {
        if(
PlayerInfo[playerid][pAdmin] < 3)
            {
              
SendClientMessage(playeridCOLOR_GRAD1"  you are not authorized to use that command!");
              return 
1;
            }
            new 
bool:unwanted[CAR_AMOUNT];
            for(new 
player=0player<MAX_PLAYERSplayer++)
           {
          if(
IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
           }
      for(new 
car 1car <= 268car++)
            {
                if(!
unwanted[car]) SetVehicleToRespawn(car);
            }
            
GetPlayerName(playeridsendernamesizeof(sendername));
            
format(stringsizeof(string), "SERVER: All unused cars respawned by admin %s."sendername);
            
BroadCast(COLOR_WHITE,string);
        }
        return 
1;
    } 
Reply
#2

Tell us the problem..
Reply
#3

Quote:

for(new car = 1; car <= 268; car++)

Hmh arent cars 400-611?
Reply
#4

yea the problem is that the cars aren't respawning and it write's unknown command
Reply
#5

Try this
pawn Код:
forward IsVehicleOccupied(vehicleid);

public OnPlayerCommandText(playerid,cmdtext[])
{

    if(strcmp(cmd, "/respawncars", true) == 0)
    {
     new playername[MAX_PLAYER_NAME];
        for(new i=0;i<MAX_VEHICLES;i++)
        {
        if(IsVehicleOccupied(i) == 0)
            {
            SetVehicleToRespawn(i);
          }
        }
    GetPlayerName(playerid,playername,sizeof(playername));
        format(string,sizeof(string),"All vehicles respawned by Admin : %s",playername);
      SendClientMessageToAll(0xAFAFAFAA, string);
      return 1;
      }

public IsVehicleOccupied(vehicleid)
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerInVehicle(i,vehicleid)) return 1;
    }
    return 0;
}
Reply
#6

its doing 2 errors
PHP код:
C:\Documents and Settings\Intel\Desktop\Sick-f.pwn(6563) : warning 209: function "OnPlayerExitVehicle" should return a value
C
:\Documents and Settings\Intel\Desktop\Sick-f.pwn(8299) : warning 204symbol is assigned a value that is never used"id"
C:\Documents and Settings\Intel\Desktop\Sick-f.pwn(24859) : warning 219local variable "playername" shadows a variable at a preceding level
C
:\Documents and Settings\Intel\Desktop\Sick-f.pwn(24873) : error 029invalid expressionassumed zero
C
:\Documents and Settings\Intel\Desktop\Sick-f.pwn(24874) : error 001expected token";"but found "{"
C:\Documents and Settings\Intel\Desktop\Sick-f.pwn(24883) : warning 225unreachable code
C
:\Documents and Settings\Intel\Desktop\Sick-f.pwn(9834) : warning 204symbol is assigned a value that is never used"checkcarhealthtimer"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


2 Errors

Reply
#7

Show your script please
Reply
#8

What do you mean to put it here?or the lines?
if the errors they are on these lines:
[php
public IsVehicleOccupied(vehicleid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInVehicle(i,vehicleid)) return 1;
}
return 0;
}
[/php]
Reply
#9

Put this at the last of your script
Reply
#10

Thank you bless you kiss you
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)