veh file save! [Mrki_Drakula] (rep+)
#1

First-
A guy Called Mrki_Drakula gave me this code to Load Vehicle's from a file! But i dont know the usage or anything about using this FS he has designed. Can someone please tell me what each function is doing over here and How to Load and Save Vehicle's using LoadStaticVehicleFromFile() , Help will be highly appreciated with rep+

Thanks
Ballu Miaa

pawn Код:
#include <a_samp>
#include <gl_common>

#define FILTERSCRIPT
#define CARS "cars.ini"

new bool:ValidVeh[MAX_VEHICLES] ;

public OnFilterScriptInit()
{
   LoadStaticVehiclesFromFile(CARS);
   return 1;
}

public OnFilterScriptExit()
{
    new fstring[288], Float:vX, Float:vY, Float:vZ, Float:vA, File:veh;
    for(new v = 0; v < MAX_VEHICLES; v++)
    {
        if(!ValidVeh[v]) return 0;
        GetVehiclePos(v, vX, vY, vZ); GetVehicleZAngle(v, vA);
        format(fstring, 288, "%d, %f, %f, %f, %f, -1, -1, -1;\r\n", GetVehicleModel(v), vX, vY, vZ, vA);
        veh = fopen(CARS, io_append);
        fwrite(veh, fstring);
        fclose(veh);
    }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    ValidVeh[vehicleid] = true;
    return 1;
}

public OnVehicleDeath(vehicleid)
{
    ValidVeh[vehicleid] = false;
    return 1;
}
Reply
#2

Second-
I want to show Kills/Deaths ratio of a player on their /Stats.
This is the PlayerInfo[playerid][pKills] & PlayerInfo[playerid][pDeaths] on pInfo enum!
Please tell me what to do to create this?
Reply
#3

For your second question, put this in your command:
pawn Код:
new str[128];
if(PlayerInfo[playerid][pDeaths] != 0)  // to avoid division by zero
{
    format(str,sizeof(str),"Your KpD ratio: %.3f",PlayerInfo[playerid][pKills]/PlayerInfo[playerid][pDeaths]);
    SendClientMessage(playerid,-1,str);
}
else
    SendClientMessage(playerid,-1,"You haven't died yet!");
Reply
#4

Allright Thanks for it Norck! But i need for first post as well
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)