28.04.2012, 15:00
Entгo eu coloco o carro pra vender e quando eu entrou nao reconhece '-'
Uso esse cуdigo na OnPLayerStateChange:
Comando pra criar:
Uso esse cуdigo na OnPLayerStateChange:
pawn Код:
if (newstate == PLAYER_STATE_DRIVER)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
for (new carro = 0; carro < MAX_CARROS; carro++)
{
new vid;
vid = GetPlayerVehicleID(playerid);
new mot, lu, alar, por, cap, porma, ob;
GetVehicleParamsEx(vid, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(vid, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
format(string, sizeof(string), "Servidor/Carros/carro%d.ini", carro);
if (pd_Existe(string))
{
if (vid == pd_Int(string, "Id"))
{
if (pd_Int(string, "cDono") == 1 || pd_Int(string, "cDono2") == 1)
{
if (strcmp(pd_Get(string, "Dono"), pname, true) == 0 || strcmp(pd_Get(string, "Dono2"), pname, true) == 0)
{
format(string, sizeof(string), "* %s, bem-vindo ao seu veiculo '%s'", pd_Get(string, "Dono"), pd_Get(string, "Nome"));
SendClientMessage(playerid, 0xC0C0C0AA, string);
}
else if (pd_Int(string, "cDono2") == 1 && pd_Int(string, "cDono") == 1)
{
format(string, sizeof(string), "Vocк й o segundo dono do carro (%s) de %s, seja bem vindo !", pd_Get(string, "Nome"), pd_Get(string, "Dono"));
SendClientMessage(playerid, 0xC0C0C0AA, string);
}
else if (pd_Int(string, "Alarme") == 0) GetVehicleParamsEx(vid, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(vid, mot, lu, VEHICLE_PARAMS_ON, por, cap, porma, ob);
format(string, sizeof(string), "* Este veiculo : '%s' й de '%s' portanto ele deixou o alarme desativado.", pd_Get(string, "Nome"), pd_Get(string, "Dono"));
SendClientMessage(playerid, 0xff6633AA, string);
if (pd_Int(string, "Alarme") == 1)
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
new tname[MAX_PLAYER_NAME];
GetPlayerName(i, tname, sizeof(tname));
if (strcmp(pd_Get(string, "Dono"), tname, true) == 0 && GetPlayerVehicleID(playerid) == pd_Int(string, "Id"))
{
format(string, sizeof(string), "* %s (%d) Tentou Roubar seu veiculo!", pname, playerid);
SendClientMessage(i, 0xff6633AA, string);
}
}
}
RemovePlayerFromVehicle(playerid);
}
}
else
{
format(string, sizeof(string), "[ CAR'S ] Este veiculo estб a venda para compra-lo use: /comprarcarro.", pd_Int(string, "Preco"));
SendClientMessage(playerid, -1, string);
SendClientMessage(playerid, -1, "* Para sair aperte 'F' ou ' ENTER '");
incar[playerid] = 1;
TogglePlayerControllable(playerid, 0);
}
}
}
}
}
pawn Код:
if (strcmp(cmd, "/carv", true) == 0)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if (IsPlayerAdmin(playerid) || pAdmin[playerid] > 5)
{
new carid, Float: ang,
preco,
cor1,
cor2;
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, Cinza, "(ERRO) Veiculo invбlido.");
return 1;
}
carid = strval(tmp);
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, Cinza, "(ERRO): /carv [id] [preзo] [cor1] [cor2]");
return 1;
}
preco = strval(tmp);
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, Cinza, "(ERRO): /carv [id] [preзo] [cor1] [cor2]");
return 1;
}
cor1 = strval(tmp);
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, Cinza, "(ERRO): /carv [id] [preзo] [cor1] [cor2]");
return 1;
}
cor2 = strval(tmp);
if (carid >= 400 && carid <= 611)
{
if (IsPlayerInAnyVehicle(playerid))
{
new Float: X,
Float: Y,
Float: Z;
GetPlayerPos(playerid, X, Y, Z);
GetVehicleZAngle(GetPlayerVehicleID(playerid), ang);
format(string, sizeof(string), "Servidor/Carros/carro%d.ini", proximocarro);
if (!pd_Existe(string))
{
pd_Criar(string);
pd_IntSet(string, "Modelo", carid);
pd_FloatSet(string, "CordX", Float: X);
pd_FloatSet(string, "CordY", Float: Y);
pd_FloatSet(string, "CordZ", Float: Z);
pd_FloatSet(string, "Angulo", Float: ang);
pd_IntSet(string, "Cor1", cor1);
pd_IntSet(string, "Cor2", cor2);
pd_IntSet(string, "Alarme", 0);
pd_IntSet(string, "cDono", 0);
pd_Set(string, "Dono", "Ninguem");
pd_IntSet(string, "cDono2", 0);
pd_Set(string, "Dono2", "Ninguem");
pd_Set(string, "Nome", "Nenhum");
pd_Set(string, "Placa", "Sem Dono");
pd_IntSet(string, "Preco", preco);
}
SetTimerEx("CriarVeiculo2", 5000, false, "dffffdd", carid, X, Y, Z, ang, cor1, cor2);
format(string, sizeof(string), "(INFO) Veiculo criado com sucesso!");
SendClientMessage(playerid, Azul, string);
return 1;
}
else
{
SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo estб em um veiculo!");
}
}
else
{
SendClientMessage(playerid, Cinza, "(ERRO) Veiculo invбlido.");
return 1;
}
}
else
{
SendClientMessage(playerid, Cinza, "(ERRO) Vocк nгo tem permissгo para isso");
return 1;
}
}