19.04.2019, 01:28
Testa ae...
PHP Code:
new carDono[MAX_PLAYERS];//Variavel pode ser subistituida pelo "pInfo" colocar no TOPO da GM ou FS
case 2000:
{
if(!response) return RemovePlayerFromVehicle(playerid);
new money = GetPlayerMoney(playerid);
if(money < Valor_Manana)
{
RemovePlayerFromVehicle(playerid);
SCM(playerid, -1, "Voce Nao tem dinheiro suficiente para esse veiculo");
}
GivePlayerMoney(playerid, -Valor_Manana);
carDono[playerid] = CreateVehicle(410, 2127.4617,-1141.9835,24.9416,5.4496, 1, 1, -1);
PutPlayerInVehicle(playerid, carDono[playerid], 0);
new file[50];
format(file, 50, "Veiculos/%s.ini", PegarNome(playerid));
if( !DOF2_FileExists(file) )
{
DOF2_CreateFile(file);
DOF2_SetString(file, "Dono", PegarNome(playerid));
DOF2_SetInt(file, "Modelo", 410);
DOF2_SetFloat(file, "CordX",2127.4617);
DOF2_SetFloat(file, "CordY",-1141.9835);
DOF2_SetFloat(file, "CordZ",24.9416);
DOF2_SetFloat(file, "CordA",5.4496);
DOF2_SetInt(file, "Cor1", 1);
DOF2_SetInt(file, "Cor2", 1);
DOF2_SaveFile();
}
}
public OnPlayerConnect(playerid)
{
carDono[playerid] = 0;
new file[50];
format(file, 50, "Veiculos/%s.ini", PegarNome(playerid));
if(!DOF2_FileExists(file))
{
carDono[playerid] = CreateVehicle(DOF2_GetInt(file, "Modelo"), DOF2_GetFloat(file, "CordX"), DOF2_GetFloat(file, "CordY"), DOF2_GetFloat(file, "CordZ"), DOF2_GetFloat(file, "CordA"), DOF2_GetInt(file, "Cor1"), DOF2_GetInt(file, "Cor2"), -1);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new file[50];
format(file, 50, "Veiculos/%s.ini", PegarNome(playerid));
if(!DOF2_FileExists(file))
{
DOF2_SetString(file, "Dono", PegarNome(playerid));
DOF2_SetInt(file, "Modelo", 410);
DOF2_SetFloat(file, "CordX",2127.4617);
DOF2_SetFloat(file, "CordY",-1141.9835);
DOF2_SetFloat(file, "CordZ",24.9416);
DOF2_SetFloat(file, "CordA",5.4496);
DOF2_SetInt(file, "Cor1", 1);
DOF2_SetInt(file, "Cor2", 1);
DOF2_SaveFile();
DestroyVehicle(carDono[playerid]);//Destroi o veiculo apos salva-lo
}
return 1;
}