SA-MP Forums Archive
Problems with my /spawn command - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problems with my /spawn command (/showthread.php?tid=160863)



Problems with my /spawn command - Jonni8 - 18.07.2010

Hey guys.
I got some trouble with my command after changing it so i can(could -.-) spawn all vehicles.

i have this command:

When i type th right names like "landstalker" oder "firetruck" it spawns me that.
But if i type something like "davsbjvn" it spawns me a pcj-600 with and shows me the id "521".
Whats wrong?

BTW the array with all the vehicles is not complete. its only done up to 520 and the gVehMAX is set to 250.

Regards


Re: Problems with my /spawn command - Jonni8 - 18.07.2010

Sorry for doulbepost...
/BUMP


Re: Problems with my /spawn command - Jonni8 - 19.07.2010

Come on... :S
/BUMP


Re: Problems with my /spawn command - tanush - 19.07.2010

So you want a cmd for admin to respawn all vehicles?


Re: Problems with my /spawn command - [HUN]Jaki - 19.07.2010

I think he wants a /vehiclespawn [vehicle name/id] command.

Can you show us the code?


Re: Problems with my /spawn command - Jay. - 19.07.2010

Quote:
Originally Posted by [HUN]Jaki
Посмотреть сообщение
I think he wants a /vehiclespawn [vehicle name/id] command.

Can you show us the code?
Or maybe he means this:


pawn Код:
SpawnPlayer(playerid);



Re: Problems with my /spawn command - Jonni8 - 19.07.2010

No... i need something to spawn all the vehicles.
I already made an array with all th vehicles and datas... only a few are missing.
They will be coming soon.
But I posted the code already.
And when i type something like "/spawn hydra" it
But when i type "/spawn avdsgbhjnck" it should give me something like "SERVER: Fahrzeug existiert nicht"
But it spawns me a pcj and shows me the id 521 ... whats wrong? (the pcj is in the place '62' in my array and i only do +400 when spawning)
BTW: i only tested with vehicles up to 520 and i commented the rest of my array

Regards

//EDIT: oh lol why the code is missing?!
CODE:
Код:
CMD:spawn(playerid, params[])
{
	if (IsPlayerAdmin(playerid) || Player[playerid][ALevel] >= 2)
	{
		new Float:x;
		new Float:y;
		new Float:z;
		new Float:a;
		
		new string[256];
		
		for (new i=0; i<sizeof(CreatedVehicles); i++)
		{
			if (CreatedVehicles[i] == 0)
			{
				if (sscanf(params, "s", params[0]))
				{
					SendClientMessage(playerid, RED, "USAGE: /spawn [object]");
					return 1;
				}	
				for ( new j=0; j<gVehMAX; j++ )
				{
					if ( !strcmp(params[0], gVeh[j][eVeh_Name], true) )
					{
						GetPlayerPos(playerid, x, y, z);
						GetPlayerFacingAngle(playerid, a);
						
						CreatedVehicles[i] = CreateVehicle(j+400, x-3, y, z+4, a, 0, 0, -1);
						format(string, sizeof(string), "Fahrzeug \"%s\" (ID: %d) wurde gespawnt.", gVeh[j][eVeh_Name], j+400);
						SendClientMessage(playerid, PURPLE, string);
						return 1;
					}
				}
				SendClientMessage(playerid, RED, "SERVER: Fahrzeug existiert nicht");
			}
		}
	}
	else 
	{
		SendClientMessage(playerid, RED, "SERVER: Du bist nicht als Admin eingeloggt oder dein AdminLevel ist zu niedrig");
	}
	return 1;
}



Re: Problems with my /spawn command - Jonni8 - 21.07.2010

PLEASE
I Really need this :S


Re: Problems with my /spawn command - [DK]JaloNik - 21.07.2010

I'mma about to go, so I just give you my code fast:
pawn Код:
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0) // by Ellis
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 3)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
                return 1;
            }
            new bool:unwanted[CAR_AMOUNT];
            foreach (Player,player)
            {
                if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
            }
            for(new car = 0; car < MAX_VEHICLES; car++)
            {
                if(!unwanted[car])
                {
                    RespawnAllCars(car);
                }
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            if(PlayerInfo[playerid][pHidden] == 1) { sendername = "Hidden Admin"; }
            format(string, sizeof(string), "SERVER: All unused cars respawned by %s.", sendername);
            BroadCast(COLOR_WHITE,string);
        }
        return 1;
    }
No time to explain sorry. XD
Goodnight!


Re: Problems with my /spawn command - Jonni8 - 22.07.2010

Hm Thanks for tryin to help... but i dont need to respawn my cars... i want to spawn them so add new ones ingame.
Later i will try an /respawn fautos because i cant respawn my fraction cars but one after an other...