11.04.2014, 18:07
Peguei um sistema na net de portamalas TODO bugado, nada funcionava consegui consertar tudo, tб guardando arma, drogas, materiais, mas pelo motivo q eu peguei era pq n sabia como pegava os carros de perto e como guardava arma numa variavel do carro n do player, o erro que ta acontecendo й:Vc pode guardar arma longe de qualquer carro(tudo,drogas,mats) e pode pegar longe de qlqr carro ta como se vc guarda-se numa variavel pro player, alguem consegue me ajudar com isso
pawn Код:
if(strcmp(cmd, "/portamalas", true) == 0)
{
new vehicleid = GetNearestVehicle(playerid, 10);
new Float: Pos[3];
GetVehiclePos(vehicleid, Pos[0], Pos[1], Pos[2]);
if(vehicleid == 0) return SendClientMessage(playerid, COLOR_WHITE, "Nenhum veiculo perto de vocк");
// se GetNearestVehicle n encontrar nenhum, a funcao retorna 0, dai essa linha ai :D
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_WHITE, "USO: /portamalas [colocar/retirar/ver]");
new text[52];
strmid(text, tmp, 0, strlen(tmp));
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,1,objective);
if(strcmp(text, "colocar", true) == 0)
{
tmp = strtok(cmdtext, idx);
new slotlivre, slotsusados;
for(new slotid = 0; slotid < 6; slotid ++)
{
if(PortaMalasUsado[vehicleid][slotid] == false)
{
slotlivre = slotid;
goto colocar_next;
}
if(PortaMalasUsado[vehicleid][slotid] == true)
{
slotsusados++;
}
}
colocar_next:
if(slotsusados == 6)
{
SendClientMessage(playerid, COLOR_WHITE, "Porta Malas Cheio");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
if(strlen(tmp) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "USO: /portamalas Colocar [Drogas/Materiais/Arma]");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
new Coloca[52];
strmid(Coloca, tmp, 0, strlen(tmp));
if(strcmp(Coloca, "Drogas", true) == 0)
{
if(PlayerInfo[playerid][pDrogas] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo tem Drogas");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "USO: /portamalas Colocar Drogas [quantidade]");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
new quant;
quant = strval(tmp);
if(quant > PlayerInfo[playerid][pDrogas])
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo tem essas drogas no Bolso");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
PlayerInfo[playerid][pDrogas] -= quant;
PortaMalasQuant[vehicleid][slotlivre] += quant;
PortaMalasNome[vehicleid][slotlivre] = "Drogas";
PortaMalasIdent[vehicleid][slotlivre] = 0;
PortaMalasUsado[vehicleid][slotlivre] = true;
format(string, sizeof(string), "Vocк Depositou %s Drogas. O veiculo tem agora %s", quant, PortaMalasQuant[vehicleid][slotlivre]);
SendClientMessage(playerid, 0xEE82EEFF, string);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
if(strcmp(Coloca, "Materiais", true) == 0)
{
if(PlayerInfo[playerid][pMats] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo tem Materiais");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "USO: /portamalas Colocar Materiais [quantidade]");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
new quant;
quant = strval(tmp);
if(quant > PlayerInfo[playerid][pMats])
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo tem essas drogas no Bolso");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
PlayerInfo[playerid][pMats] -= quant;
PortaMalasQuant[vehicleid][slotlivre] += quant;
PortaMalasNome[vehicleid][slotlivre] = "Materiais";
PortaMalasIdent[vehicleid][slotlivre] = 0;
PortaMalasUsado[vehicleid][slotlivre] = true;
format(string, sizeof(string), "Vocк Depositou %s Materiais. O veiculo tem agora %s", quant, PortaMalasQuant[vehicleid][slotlivre]);
SendClientMessage(playerid, 0xEE82EEFF, string);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
if(strcmp(Coloca, "Arma", true) == 0)
{
tmp = strtok(cmdtext, idx);
/*
if(strlen(tmp) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "USO: /portamalas Colocar Arma");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
*/
new colArma = GetPlayerWeapon(playerid);
if(colArma < 16)
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк nao pode guardar essa arma");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
new ammo = GetPlayerAmmo(playerid);
SetPlayerAmmo(playerid, colArma, 0);//Remove a Arma
PortaMalasNome[vehicleid][slotlivre] = "Arma";
PortaMalasIdent[vehicleid][slotlivre] = colArma;
PortaMalasQuant[vehicleid][slotlivre] = ammo;
PortaMalasUsado[vehicleid][slotlivre] = true;
new nomearma[32];
GetWeaponName(colArma, nomearma, sizeof(nomearma));
format(string, sizeof(string), "Vocк colocou %d balas de %s", ammo, nomearma);
SendClientMessage(playerid, 0xEE82EEFF, string);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
return 1;
}
if(strcmp(text, "retirar", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "USO: /portamalas Retirar [Slot]");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
new slotid;
slotid = strval(tmp);
if(slotid < 0 || slotid > 5)
{
SendClientMessage(playerid, COLOR_WHITE, "Slot entre 0 e 5");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
if(PortaMalasUsado[vehicleid][slotid] == false)
{
SendClientMessage(playerid, COLOR_WHITE, "Slot Vazio");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
if(strcmp(PortaMalasNome[vehicleid][slotid], "Drogas", true) == 0)
{
PlayerInfo[playerid][pDrogas] += PortaMalasQuant[vehicleid][slotid];
format(string, sizeof(string), "Vocк retirou %d drogas do veiculo", PortaMalasQuant[vehicleid][slotid]);
SendClientMessage(playerid, 0xFF8C69FF, string);
PortaMalasNome[vehicleid][slotid] = " ";
PortaMalasIdent[vehicleid][slotid] = 0;
PortaMalasQuant[vehicleid][slotid] = 0;
PortaMalasUsado[vehicleid][slotid] = false;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
if(strcmp(PortaMalasNome[vehicleid][slotid], "Materiais", true) == 0)
{
PlayerInfo[playerid][pMats] += PortaMalasQuant[vehicleid][slotid];
format(string, sizeof(string), "Vocк retirou %d materiais do veiculo", PortaMalasQuant[vehicleid][slotid]);
SendClientMessage(playerid, 0xFF8C69FF, string);
PortaMalasNome[vehicleid][slotid] = " ";
PortaMalasIdent[vehicleid][slotid] = 0;
PortaMalasQuant[vehicleid][slotid] = 0;
PortaMalasUsado[vehicleid][slotid] = false;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
if(strcmp(PortaMalasNome[vehicleid][slotid], "Arma", true) == 0)
{
GivePlayerWeapon(playerid, PortaMalasIdent[vehicleid][slotid], PortaMalasQuant[vehicleid][slotid]);
new ArmaName[32];
GetWeaponName(PortaMalasIdent[vehicleid][slotid], ArmaName, sizeof(ArmaName));
format(string, sizeof(string), "Vocк retirou uma %s com %d balas", ArmaName, PortaMalasQuant[vehicleid][slotid]);
SendClientMessage(playerid, 0xFF8C69FF, string);
PortaMalasNome[vehicleid][slotid] = " ";
PortaMalasIdent[vehicleid][slotid] = 0;
PortaMalasQuant[vehicleid][slotid] = 0;
PortaMalasUsado[vehicleid][slotid] = false;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
return 1;
}
if(strcmp(text, "ver", true) == 0)
{
new slotid = 0;
while(slotid < 6)
{
if(PortaMalasUsado[vehicleid][slotid] == true)
{
new Name[52];
strmid(Name, PortaMalasNome[vehicleid][slotid], 0, strlen(PortaMalasNome[vehicleid][slotid]));
if(strcmp(Name, "Arma", true) == 0)
{
new armaName[32];
GetWeaponName(PortaMalasIdent[vehicleid][slotid], armaName, sizeof(armaName));
format(string, sizeof(string), "Slot %d: %s %s : %d Balas", slotid, PortaMalasNome[vehicleid][slotid], armaName, PortaMalasQuant[vehicleid][slotid]);
SendClientMessage(playerid, 0xF0FFFFFF, string);
}
else if(strcmp(Name, "Materiais", true) == 0)
{
format(string, sizeof(string), "Slot %d: %s : %d Materiais", slotid, PortaMalasNome[vehicleid][slotid], PortaMalasQuant[vehicleid][slotid]);
SendClientMessage(playerid, 0xF0FFFFFF, string);
}
else if(strcmp(Name, "Drogas", true) == 0)
{
format(string, sizeof(string), "Slot %d: %s : %d Drogas", slotid, PortaMalasNome[vehicleid][slotid], PortaMalasQuant[vehicleid][slotid]);
SendClientMessage(playerid, 0xF0FFFFFF, string);
}
}
slotid++;
}
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
return 1;
}
return 1;
}