Respawn used cars
#1

Im trying to get this script to work. Basically the idea is to respawn all cars that are unused. So if someone is IN the car, it doesn't get respawn. the code
Код:
  {
        if(IsPlayerInAnyVehicle(playerid) {  unwanted[GetPlayerVehicleID(playerid])=true; }
        }
is not compiling and it gives me errors. i have no clue what the problem is. if i take it out it compiles fine. but if someone is driving a car WITHOUT that line in it will kick them out and respawn the car.

full script:

Код:
if(strcmp(cmd, "/respawnallcars", true) == 0)
{
format(string, sizeof(string), "-------------------------------------------------------------------------------------------------------------");
SendClientMessageToAll(COLOR_WHITE,string);
format(string, sizeof(string), "AP:RP SERVER NOTICE");
SendClientMessageToAll(COLOR_BRIGHTRED,string);
format(string, sizeof(string)," An AP:RP Staff Member has respawned all vehicles",giveplayer);
SendClientMessageToAll(COLOR_GREY,string);
format(string, sizeof(string), "-------------------------------------------------------------------------------------------------------------");
SendClientMessageToAll(COLOR_WHITE,string);
printf("%s",string);

       {
        if(IsPlayerInAnyVehicle(playerid) {  unwanted[GetPlayerVehicleID(playerid])=true; }
        }

for(new v = 0; v <= MAX_VEHICLES; v++)
SetVehicleToRespawn(v);
}
any help is appreciated.

thank you
Reply
#2

Did you define unwanted? If not, you should have
pawn Код:
new bool:unwanted;
under the command.
Reply
#3

C:\Users\Tyler\Desktop\FCRP Server\gamemodes\fcrpv1.pwn(240) : error 020: invalid symbol name ""
Reply
#4

Sorry, forgot it should be this:
pawn Код:
new bool:unwanted[MAX_VEHICLES];
Try
Reply
#5

Why dont you just use AddStaticVehicleEx?
Reply
#6

still doesnt work. i get:
C:\Users\Tyler\Desktop\FCRP Server\gamemodes\fcrpv1.pwn(274) : error 020: invalid symbol name ""
on that line.

also the error codes im getting for the command are:

C:\Users\Tyler\Desktop\FCRP Server\gamemodes\fcrpv1.pwn(625 : error 001: expected token: "-identifier-", but found ";"
C:\Users\Tyler\Desktop\FCRP Server\gamemodes\fcrpv1.pwn(6270) : error 001: expected token: ")", but found "{"
C:\Users\Tyler\Desktop\FCRP Server\gamemodes\fcrpv1.pwn(6270) : error 029: invalid expression, assumed zero
C:\Users\Tyler\Desktop\FCRP Server\gamemodes\fcrpv1.pwn(6270) : error 076: syntax error in the expression, or invalid function call
C:\Users\Tyler\Desktop\FCRP Server\gamemodes\fcrpv1.pwn(6270) : fatal error 107: too many error messages on one line
Reply
#7

If you use format, you should be passing values to it. For the lines where you have ------------.... you should just use
pawn Код:
SendClientMessageToAll(color, "------------------...");
instead of format.

Also, the line where you have "An AP:RP staff member..." should just be SendClientMessageToAll.

The only time you would use format in this case would be if you wanted to say which staff member, like "AP:RP Staff member Infinitas has respawned all vehicles".

Another thing: The "if" statement doesn't need to be in brackets. it should just be
pawn Код:
if(IsPlayerInAnyVehicle(playerid) { unwanted[GetPlayerVehicleID(playerid)] = true; }
Reply
#8

Changed, still getting
C:\Users\Tyler\Desktop\FCRP Server\gamemodes\fcrpv1.pwn(6805) : error 001: expected token: ")", but found "{"
C:\Users\Tyler\Desktop\FCRP Server\gamemodes\fcrpv1.pwn(6805) : error 029: invalid expression, assumed zero
C:\Users\Tyler\Desktop\FCRP Server\gamemodes\fcrpv1.pwn(6805) : error 001: expected token: ",", but found "]"
C:\Users\Tyler\Desktop\FCRP Server\gamemodes\fcrpv1.pwn(6805) : fatal error 107: too many error messages on one line


-.-'
Reply
#9

Код:
if(IsPlayerInAnyVehicle(playerid)) { unwanted[GetPlayerVehicleID(playerid)] = true; }
try this missing )
Код:
if(strcmp(cmd, "/respawnallcars", true) == 0)
{

SendClientMessageToAll(COLOR_WHITE,"-------------------------------------------------------------------------------------------------------------");
SendClientMessageToAll(COLOR_BRIGHTRED, "AP:RP SERVER NOTICE");
GetPlayerName(playerid,giveplayer,MAX_PLAYER_NAME);
format(string, sizeof(string),"AP:RP Staff Member %s has respawned all vehicles",giveplayer);
SendClientMessageToAll(COLOR_GREY,string);
SendClientMessageToAll(COLOR_WHITE,"-------------------------------------------------------------------------------------------------------------");
printf("%s",string);

       {
        if(IsPlayerInAnyVehicle(playerid)) {  unwanted[GetPlayerVehicleID(playerid])=true; }
        }

for(new v = 0; v <= MAX_VEHICLES; v++)
SetVehicleToRespawn(v);
}
Reply
#10

Still getting the same errors
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)