09.05.2013, 21:46
Hello guys.
I have a problem with a command on my server when i use this command /comprarcarro ( /buycar ) command does nothing
I have a problem with a command on my server when i use this command /comprarcarro ( /buycar ) command does nothing
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[128];
if (strcmp(cmdtext, "/comprarcarro", true) == 0)
{
new VehicleID;
VehicleID = GetPlayerVehicleID(playerid);
new pname[MAX_PLAYER_NAME];
new aname[MAX_PLAYER_NAME];
new file[128];
GetPlayerName(playerid, aname, sizeof(aname));
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "Contas/%s.ini", aname);
for (new carro = 0; carro < MAX_VEHICLES; carro++)
{
format(string, sizeof(string), "carro%d.ini", carro);
if (strfind(pname,dini_Get(string,"Dono"),true) == 0)
{
SendClientMessage(playerid, -1, "Vocк jб tem um carro");
return 1;
}
if (IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0 && VehicleID == dini_Int(string, "Id"))
{
if (dini_Int(string, "TDono") == 1) return SendClientMessage(playerid, -1, "Esse Carro jб tem dono!");
if (GetPlayerMoney(playerid) >= dini_Int(string, "Preco"))
{
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
dini_IntSet(string, "TDono", 1);
dini_Set(string, "Dono", aname);
SendClientMessage(playerid, -1, "(INFO) Veiculo comprado com sucesso!");
SendClientMessage(playerid, -1, "(INFO) Para ver os comandos do veiculo, use: /meucarro");
GivePlayerMoney(playerid, -dini_Int(string, "Preco"));
TogglePlayerControllable(playerid, 3);
return 1;
} else {
SendClientMessage(playerid, -1, "(ERRO) Vocк nгo tem dinheiro suficiente!");
return 1;
}
}
}
return 1;
}
return 0;
}