[Pomoc] Respawn vozila

Započeo Yakavetta, Oktobar 08, 2012, 19:13:44 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 3 gostiju pregledaju ovu temu.

Yakavetta

Skripta koju koristim : Be final verzion
Problem: Kad upisem /rac kaze da ce se vozila respawnovati za 10sec al prodju 10 sec i opet nece da se respawn
Deo skripte:
    if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0) // by Ellis
	{
	    if(IsPlayerConnected(playerid))
	    {
      	    if(PlayerInfo[playerid][pAdmin] < 1340)
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "   Niste ovlasteni da koristite tu komandu!");
			    return 1;
			}
             SetTimer("RespawnVozila", 10000, 0);
			 format(string, sizeof(string), "{37C880}AdmCmd: {FFFFFF}%s je pokrenuo respawn vozila. {37C880}Vozila ce se respawnovati za {FFFFFF}10 {37C880}sekundi !", sendername);
			 BroadCast(COLOR_WHITE,string);
		 }
  	    return 1;
	}


Yakavetta

evo ti
public RespawnVozila(playerid)
{
new bool:unwanted[CAR_AMOUNT];
foreach (Player, i)
{
if(IsPlayerInAnyVehicle(i)) { unwanted[GetPlayerVehicleID(i)]=true; }
}
for(new car = 0; car <= 1000; car++)
{
if(!unwanted[car]) SetVehicleToRespawn(car);
}
new string[256];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "{D54D2B}INFO: Sva vozila na serveru su respawnovana.");
BroadCast(COLOR_WHITE,string);
return 1;
}
public FarmerExit(playerid)
{
	if(IsPlayerConnected(playerid))
	{
	    new vehicleid = GetPlayerVehicleID(playerid);
	    if(IsAHarvest(vehicleid))
	    {
	        return 1;
	    }
	    if(FarmerVar[playerid] == 0)
	    {
	        return 1;
	    }
	    if(FarmerPickup[playerid][0] >= 1 && FarmerPickup[playerid][0] <= 22)
		{
			FarmerPickup[playerid][0]--;
		}
    	DisablePlayerCheckpoint(playerid);
    	FarmerVar[playerid] = 0;
	}
	return 1;
}

Vegas.

    if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0) // by Ellis
	{
	    if(IsPlayerConnected(playerid))
	    {
      	    if(PlayerInfo[playerid][pAdmin] < 1340)
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "   Niste ovlasteni da koristite tu komandu!");
			    return 1;
			}
             SetTimer("Racajauta", 10000, 0);
			 format(string, sizeof(string), "{37C880}AdmCmd: {FFFFFF}%s je pokrenuo respawn vozila. {37C880}Vozila ce se respawnovati za {FFFFFF}10 {37C880}sekundi !", sendername);
			 BroadCast(COLOR_WHITE,string);
		 }
  	    return 1;
	}

public Racajauta()
{
	new bool:uvozilu[MAX_VEHICLES] = 0;
	for(new p; p <= MAX_PLAYERS; p++)
	{
		if( IsPlayerInAnyVehicle(p)) return uvozilu[MAX_VEHICLES] = 1;
	}
	for(new car; car <= MAX_VEHICLES; car++)
	{
	    if(!uvozilu[car] ) SetVehicleToRespawn(car);
	}
}

Yakavetta

sad mi izbacilo neke erore i warninge u vezi toga
C:\Documents and Settings\Yakavetta\My Documents\BD\gamemodes\bdrp.pwn(60919) : warning 209: function "Racajauta" should return a value
C:\Documents and Settings\Yakavetta\My Documents\BD\gamemodes\bdrp.pwn(60913) : error 032: array index out of bounds (variable "uvozilu")
C:\Documents and Settings\Yakavetta\My Documents\BD\gamemodes\bdrp.pwn(60908) : warning 235: public function lacks forward declaration (symbol "Racajauta")

Pokušaj si popraviti errore&warninge sam

A možeti pomoći ovo:


http://balkan-samp.com/forum/index.php?topic=40233.0

Poslednja Izmena: Oktobar 08, 2012, 21:41:32 POSLE PODNE od Deep Dark

Vegas.

forward RacajAuta();
public Racajauta()
{
	new bool:uvozilu[MAX_VEHICLES] = 0;
	for(new p; p <= MAX_PLAYERS; p++)
	{
		if( IsPlayerInAnyVehicle(p)) return uvozilu[MAX_VEHICLES] = 1;
	}
	for(new car; car <= MAX_VEHICLES; car++)
	{
	    if(!uvozilu[car] ) SetVehicleToRespawn(car);
	}
	return 1;
}