Problems with my /spawn command
#1

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
Reply
#2

Sorry for doulbepost...
/BUMP
Reply
#3

Come on... :S
/BUMP
Reply
#4

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

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

Can you show us the code?
Reply
#6

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);
Reply
#7

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;
}
Reply
#8

PLEASE
I Really need this :S
Reply
#9

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!
Reply
#10

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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)