[Help]Dynamic vehicle System.
#1

Hello sa-mp.
I' need help with my dynamic vehicle system.
Well, It's working.
Only...
It's not writing the new positions, when typing /saveveh.

This is the command.
Also, How can i change it?
So instead of typing /saveveh vehID.
It will check the vehicle idx from the current player.

Код:
CMD:saveveh(playerid, params[])
{
	new object;
    new Float:x, Float:y, Float:z, Float:an;
    new c1, c2;
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pMapper] < 3 && PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	if(sscanf(params, "i", object)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /saveveh [vehid]");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You arent in any dynamic vehicle.");
	for(new idx=1; idx<MAX_vvveh; idx++)
	{
	    if(!vvvehInfo[idx][vvvModel])
	    {
	        new currentveh = idx;
            GetVehiclePos(currentveh, x, y, z);
            GetVehicleZAngle(currentveh, an);
            GetVehicleColor(currentveh, c1, c2);
		    vvvehInfo[idx][vvvX] = x;
			vvvehInfo[idx][vvvY] = y;
			vvvehInfo[idx][vvvZ] = z;
			vvvehInfo[idx][vvvAn] = an;
			vvvehInfo[idx][vvvC1] = c1;
			vvvehInfo[idx][vvvC2] = c2;
            SendClientMessage(playerid, COLOR_WHITE, "You saved the vehicle.");
			idx = MAX_vvveh;
		}
	}
	return 1;
}
See?
Also.
It's working.
But it's not Writing the new data.
someone got the solution?
Then, when i'm compiling the gamemode.
I get this errors.

pawn Код:
Server\gamemodes\sgrp.pwn(2659) : warning 213: tag mismatch
CServer\gamemodes\sgrp.pwn(2660) : warning 213: tag mismatch
These are from the stock that will load all vehicles.

pawn Код:
stock Loadvvveh()
{
    new dinfo[7][128];
    new string[256];
    new File:file = fopen("vvveh.cfg", io_read);
    if(file)
    {
        new idx = 1;
        while(idx < MAX_vvveh)
        {
            fread(file, string);
            split(string, dinfo, '|');
            vvvehInfo[idx][vvvModel] = strval(dinfo[0]);
            vvvehInfo[idx][vvvX] = floatstr(dinfo[1]);
            vvvehInfo[idx][vvvY] = floatstr(dinfo[2]);
            vvvehInfo[idx][vvvZ] = floatstr(dinfo[3]);
            vvvehInfo[idx][vvvAn] = floatstr(dinfo[4]);
            vvvehInfo[idx][vvvC1] = floatstr(dinfo[5]); //line 2659
            vvvehInfo[idx][vvvC2] = floatstr(dinfo[6]); // line 2660
            if(vvvehInfo[idx][vvvModel]) // If gate exists
            {
                vvvehInfo[idx][vvveh] = CreateVehicle(vvvehInfo[idx][vvvModel], vvvehInfo[idx][vvvX], vvvehInfo[idx][vvvY], vvvehInfo[idx][vvvZ], vvvehInfo[idx][vvvAn], vvvehInfo[idx][vvvC1], vvvehInfo[idx][vvvC2], 1200);
            }
            idx++;
        }
    }
    print("Dynamic vehicles loaded successfully.");
    return 1;
}
That's all,
I hope somebody could help me.
I'll apreciate it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)