02.02.2014, 05:24
Please help. I dont know a lot of this strcmp.
this is my command
Is just not Working
this is my command
pawn Код:
CMD:vender(playerid, params[])
{
if(isnull(params))
{
SendClientMessageEx(playerid, 0x008FECFF, "Modo de uso: {FFFFFF}/vender [Item]");
if(Info[playerid][pMember] == 9 || Info[playerid][pLeader] == 9)
{
SendClientMessageEx(playerid, 0x008FECFF, "Informaciуn: {FFFFFF}pala, maza, ghumo, motosierra, extinguidor");
}
return 1;
}
if(strcmp(params, "vehiculo", true) == 0)
{
if(PlayerToPoint(5.0, playerid, 528.6371,-1302.6929,5094.9453))
{
new vstring[1024];
for(new i; i < MAX_PLAYERVEHICLES; i++)
{
if(PlayerVehicleInfo[playerid][i][pvId] > INVALID_PLAYER_VEHICLE_ID)
format(vstring, sizeof(vstring), "%s\n%s", vstring, VehicleName[PlayerVehicleInfo[playerid][i][pvModelId] - 400]);
else if(PlayerVehicleInfo[playerid][i][pvImpounded] == 1)
format(vstring, sizeof(vstring), "%s\n%s (Embargado)", vstring, VehicleName[PlayerVehicleInfo[playerid][i][pvModelId] - 400]);
else
format(vstring, sizeof(vstring), "%s\nVacнo", vstring);
}
SafeDialogEx(playerid, SELLCAR, DIALOG_STYLE_LIST, "Venta de Vehнculos", vstring, "Vender", "Cancelar");
return 1;
}
else SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}No estбs en la empresa de vehнculos.");
return 1;
}
/*if(strcmp(params, "rz", giveplayerid, amount, price)) return SendClientMessageEx(playerid, 0x008FECFF, "Modo de uso: {FFFFFF}/vender rz [ID] [cantidad] [precio]");
{
new string[200], giveplayerid, amount, price;
if(amount < 0 || amount > 9999999) { SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Los valores no pueden ser mayores a 9999999 monedas ni menores a 1."); return 1; }
if(IsPlayerConnected(playerid)){
if(IsPlayerConnected(giveplayerid)){
if(ProxDetectorS(8.0, playerid, giveplayerid)){
if(giveplayerid == playerid) return SendClientMessageEx(playerid, 0x008FECFF, "Informaciуn: {FFFFFF}No puedes venderte a ti mismo.");
format(string, sizeof(string), "[Ventas] {FFFFFF}Le ofreciste {F5FF00}%s {FFFFFF}Monedas Rz a {F5FF00}%s {FFFFFF}por {00CC00}$%d", amount, GetPlayerNameEx(giveplayerid), price);
SendClientMessageEx(playerid, 0x00CC00FF, string);
format(string, sizeof(string), "%s {FFFFFF}te ofrece {F5FF00}%s {FFFFFF}Monedas Rz por {00CC00}$%d, {FFFFFF}para aceptarla usa {F5FF00}/aceptar rz", GetPlayerNameEx(playerid), amount, price);
SendClientMessageEx(giveplayerid, 0xF5FF00FF, string);
FOffer[giveplayerid] = playerid;
FPrice[giveplayerid] = price;
return FAmount[giveplayerid] = amount;
}
else return SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Ese jugador estб lejos de ti.");
}
}
else SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}ID Invбlida.");
return 1;
}*/
if(strcmp(params, "crack", true) == 0)
{
new string[200], giveplayerid, needed, money;
if(sscanf(params, "ddd", giveplayerid, needed, money)) return SendClientMessageEx(playerid, 0x008FECFF, "Modo de uso: {FFFFFF}/vender crack [ID] [gramos] [precio]");
if(needed < 1 || needed > 10000) { SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Los valores no pueden ser mayores a 10000 gramos."); return 1; }
if(needed > Info[playerid][pCrack]) { SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}No tienes suficiente Crack para venderlos"); return 1; }
if(IsPlayerConnected(giveplayerid)) {
if(giveplayerid != INVALID_PLAYER_ID){
if (ProxDetectorS(8.0, playerid, giveplayerid)){
if(giveplayerid == playerid) return SendClientMessageEx(playerid, COLOR_GREY, "No puedes venderte a ti mismo!");
format(string, sizeof(string), "[Ventas] {FFFFFF}Le ofreciste {F5FF00}%d {FFFFFF} gr de crack a {F5FF00}%s {FFFFFF}por {00CC00}$%d", needed, GetPlayerNameEx(giveplayerid), money);
SendClientMessageEx(playerid, 0x00CC00FF, string);
format(string, sizeof(string), "%s {FFFFFF}te ofrece {F5FF00}%s {FFFFFF}gr de crack por {00CC00}$%d, {FFFFFF}para aceptarlos usa {F5FF00}/aceptar crack", GetPlayerNameEx(playerid), needed, money);
SendClientMessageEx(giveplayerid, 0xF5FF00FF, string);
CrackOffer[giveplayerid] = playerid;
CrackPrice[giveplayerid] = money;
CrackGram[giveplayerid] = needed;
}
else return SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Este jugador estб lejos de ti.");
}
}
else SendClientMessageEx(playerid,COLOR_DIALOGO1, "ERROR: {FFFFFF}Ese jugador estб desconectado.");
return 1;
}
if(strcmp(params, "remedios", true) == 0)
{
new string[200], giveplayerid, needed, money;
if(sscanf(params, "ddd", giveplayerid, needed, money)) return SendClientMessageEx(playerid, 0x008FECFF, "Modo de uso: {FFFFFF}/vender remedios [ID] [cantidad] [precio]");
if(needed < 1 || needed > 10000) { SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Los gramos no pueden ser menor que 1, ni mayor que 10000"); return 1; }
if(needed > Info[playerid][pPot]) { SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}No tienes tantos Medicamentos para vender."); return 1; }
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid)
{
SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}No puedes venderte a ti mismo.");
return 1;
}
format(string, sizeof(string), "[Ventas] {FFFFFF}Le ofreciste {F5FF00}%s {FFFFFF}medicamentos a {F5FF00}%s {FFFFFF}por {00CC00}$%d", needed, GetPlayerNameEx(giveplayerid), money);
SendClientMessageEx(playerid, 0x00CC00FF, string);
format(string, sizeof(string), "%s {FFFFFF}te ofrece {F5FF00}%s {FFFFFF}medicamentos por {00CC00}$%d, {FFFFFF}para aceptarlos usa {F5FF00}/aceptar medicamentos", GetPlayerNameEx(playerid), needed, money);
SendClientMessageEx(giveplayerid, 0xF5FF00FF, string);
PotOffer[giveplayerid] = playerid;
PotPrice[giveplayerid] = money;
PotGram[giveplayerid] = needed;
}
else return SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Ese jugador estб lejos de ti.");
}
}
else SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Ese jugador estб desconectado.");
return 1;
}
if(strcmp(params, "medicamentos", true) == 0)
{
new string[200], giveplayerid, needed, money;
if(sscanf(params, "ddd", giveplayerid, needed, money)) return SendClientMessageEx(playerid, 0x008FECFF, "Modo de uso: {FFFFFF}/vender medicamentos [ID] [cantidad] [precio]");
if(needed < 1 || needed > 10000) { SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Los gramos no pueden ser menor que 1, ni mayor que 10000"); return 1; }
if(needed > Info[playerid][pPot]) { SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}No tienes tantos Medicamentos para vender."); return 1; }
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid)
{
SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}No puedes venderte a ti mismo.");
return 1;
}
format(string, sizeof(string), "[Ventas] {FFFFFF}Le ofreciste {F5FF00}%s {FFFFFF}medicamentos a {F5FF00}%s {FFFFFF}por {00CC00}$%d", needed, GetPlayerNameEx(giveplayerid), money);
SendClientMessageEx(playerid, 0x00CC00FF, string);
format(string, sizeof(string), "%s {FFFFFF}te ofrece {F5FF00}%s {FFFFFF}medicamentos por {00CC00}$%d, {FFFFFF}para aceptarlos usa {F5FF00}/aceptar medicamentos", GetPlayerNameEx(playerid), needed, money);
SendClientMessageEx(giveplayerid, 0xF5FF00FF, string);
PotOffer[giveplayerid] = playerid;
PotPrice[giveplayerid] = money;
PotGram[giveplayerid] = needed;
}
else return SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Ese jugador estб lejos de ti.");
}
}
else SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Ese jugador estб desconectado.");
return 1;
}
if(strcmp(params, "coche", true) == 0)
{
new string[200], giveplayerid, price;
for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
{
if(IsPlayerInVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId]))
{
new Float:health;
GetVehicleHealth(PlayerVehicleInfo[playerid][d][pvId], health);
if(Info[playerid][pLevel] == 2)
{
SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Necesitas ser nivel 2 para poder vender vehнculos.");
return 1;
}
if(health < 500) return SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}El vehiculo estб muy daсado para ser vendido.");
if(sscanf(params, "dd", giveplayerid, price)) return SendClientMessageEx(playerid, 0x008FECFF, "Modo de uso: {FFFFFF}/vender coche [ID] [precio] dentro del vehнculo.");
if(playerid == giveplayerid)
{
SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}No puedes venderte el auto tъ mismo.");
return 1;
}
if(!IsPlayerConnected(giveplayerid)) return SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Jugador no estб conectado al servidor.");
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
VehicleOffer[giveplayerid] = playerid;
VehicleId[giveplayerid] = d;
VehiclePrice[giveplayerid] = price;
format(string, sizeof(string), "[Ventas] {FFFFFF}Le ofreciste tu {F5FF00}%s {FFFFFF}a {F5FF00}%s {FFFFFF}por {00CC00}$%d", GetVehicleName(PlayerVehicleInfo[playerid][d][pvId]), GetPlayerNameEx(giveplayerid), price);
SendClientMessageEx(playerid, 0x00CC00FF, string);
format(string, sizeof(string), "%s {FFFFFF}te ofrece su {F5FF00}%s {FFFFFF}por {00CC00}$%d, {FFFFFF}para aceptarla usa {F5FF00}/aceptar coche", GetPlayerNameEx(playerid), GetVehicleName(PlayerVehicleInfo[playerid][d][pvId]), price);
SendClientMessageEx(giveplayerid, 0xF5FF00FF, string);
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Ese jugador no estб lejos de ti");
return 1;
}
}
}
SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Tu necesitas estar dentro de tu vehнculo.");
return 1;
}
if(strcmp(params, "arma", true) == 0)
{
new string[200],id,weapon,price;
if(sscanf(params, "ui", id, price))
return SendClientMessage(playerid, 0x008FECFF, "Modo de uso: {FFFFFF}/vender arma [ID] [precio]");
else if(Info[playerid][pEstado]==0)
{
if(id == playerid)
return SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}No puedes venderte un arma a ti mismo");
if(IsPlayerConnected(id))
{
if(ProxDetectorS(6.0, playerid, id) && !IsPlayerInAnyVehicle(playerid))
{
if(IsPlayerInAnyVehicle(id))
return SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}No puedes vender un arma si el jugador esta en un coche.");
weapon = GetPlayerWeapon(playerid);
switch(weapon)
{
case 18, 35, 36, 37, 39, 40, 44, 45, 46, 0: SendClientMessage(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Arma Invбlida.");
default:
{
format(string, sizeof(string), "[Ventas] {FFFFFF}Le ofreciste tu {F5FF00}%s {FFFFFF}a {F5FF00}%s {FFFFFF}por {00CC00}$%d", GunNames[weapon], GetPlayerNameEx(id), price);
SendClientMessage(playerid, 0x00CC00FF, string);
format(string, sizeof(string), "%s {FFFFFF}te ofrece su {F5FF00}%s {FFFFFF}por {00CC00}$%d, {FFFFFF}para aceptarla usa {F5FF00}/aceptar arma", GetPlayerNameEx(playerid), GunNames[weapon], price);
SendClientMessage(id, 0xF5FF00FF, string);
Precio[id] = price;
SetPVarInt(id,"gunID",playerid);
SetPVarInt(playerid,"gun",weapon);
SetPVarInt(playerid,"slot",GetWeaponSlot(weapon));
}
}
}
else SendClientMessage(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Ese jugador estб lejos de ti.");
}
else SendClientMessage(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Jugador no conectado.");
}
else SendClientMessage(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}No puedes hacer esto mientras estas tazeado, esposado o congelado.");
return 1;
}
if(strcmp(params, "piezas", true) == 0)
{
new string[200], giveplayerid, amount, price;
if(sscanf(params, "ddd", giveplayerid, amount, price)) return SendClientMessageEx(playerid, 0x008FECFF, "Modo de uso: {FFFFFF}/vender piezas [ID] [cantidad] [precio]");
if(amount < 1 || amount > 99999999) { SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Los valores no pueden ser mayores a 99999999 gramos ni menores a 1."); return 1; }
if (GetPVarInt(playerid, "ArmsTimer") > 0)
{
format(string, sizeof(string), "Informaciуn: {FFFFFF}Por favor espera {FF0404}%d segundos.", GetPVarInt(playerid, "ArmsTimer"));
SendClientMessageEx(playerid,COLOR_AZULL,string);
return 1;
}
if(IsPlayerConnected(playerid))
{
if(IsPlayerConnected(giveplayerid))
{
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid)
{
SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}No puedes venderte a ti mismo.");
return 1;
}
format(string, sizeof(string), "[Ventas] {FFFFFF}Le ofreciste {F5FF00}%s {FFFFFF}piezas a {F5FF00}%s {FFFFFF}por {00CC00}$%d", amount, GetPlayerNameEx(giveplayerid), price);
SendClientMessageEx(playerid, 0x00CC00FF, string);
format(string, sizeof(string), "%s {FFFFFF}te ofrece {F5FF00}%s {FFFFFF}piezas por {00CC00}$%d, {FFFFFF}para aceptarla usa {F5FF00}/aceptar piezas", GetPlayerNameEx(playerid), amount, price);
SendClientMessageEx(giveplayerid, 0xF5FF00FF, string);
MatsOffer[giveplayerid] = playerid;
MatsPrice[giveplayerid] = price;
return MatsAmount[giveplayerid] = amount;
}
else
{
SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Ese jugador estб lejos de ti.");
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}ID Invбlido.");
}
return 1;
}
else SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Has ingresado un comando incorrecto, usa /vender [Item]");
return 1;
}