if(strcmp(cmd, "/venderveh", true) == 0)
{
new giveplayerid;
new newcar = GetPlayerVehicleID(playerid);
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext,idx);
if(NFS(playerid))
{
if (!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /venderveh [playerid/partOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (giveplayerid == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_GREY, "Jugador Off Line");
return 1;
}
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[giveplayerid][pLevel] < 3)
{
SendClientMessage(playerid, COLOR_GREY, "Necesita Minimo Nivel 3, Para tener Un Coche..!");
return 1;
}
if(CarInfo[newcar][cOwned]==1)
{
SendClientMessage(playerid, COLOR_GREY, "Vendedor: Este Coche Ya Tiene Dueсo, Lo Siento.");
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}
if(PlayerInfo[giveplayerid][pPcarkey] == 999){}
else if(PlayerInfo[giveplayerid][pPcarkey2] == 999) { }
else { SendClientMessage(playerid, COLOR_GREY, "Unicamente Se Permite Tener 2 Coches Por Persona."); return 1; }
if(GetPlayerMoney(giveplayerid) >= CarInfo[idcar][cValue])
{
if(PlayerInfo[giveplayerid][pPcarkey] == 999) { PlayerInfo[giveplayerid][pPcarkey] = idcar; }
else if(PlayerInfo[giveplayerid][pPcarkey2] == 999) { PlayerInfo[giveplayerid][pPcarkey2] = idcar; }
else { return 1; }
ShowPlayerDialog(giveplayerid,2014,DIALOG_STYLE_MSGBOX,"Confirmacion","їDesea Aceptar este auto?","Si","No");
return 1;
}else SendClientMessage(playerid, COLOR_GREY, "Sin Dinero suficiente");
}
} else SendClientMessage(playerid, COLOR_GREY, "No Eres vendedor de autos");
return 1;
}
if(dialogid == 2014){
if(response){
new giveplayerid;
new tmp[25];
new idcar = GetPlayerVehicleID(playerid);
new newcar = GetPlayerVehicleID(playerid);
giveplayerid = ReturnUser(tmp);
GetPlayerName(giveplayerid, sendername, sizeof(sendername));
CarInfo[idcar][cOwned] = 1;
CarInfo[idcar][cOwner] = sendername;
SafeGivePlayerMoney(giveplayerid,-CarInfo[idcar][cValue]);
SBizzInfo[11][sbTill] += CarInfo[idcar][cValue]*2; // Conce Lujo
SBizzInfo[16][sbTill] += CarInfo[idcar][cValue]; // Conce Normal
SBizzInfo[22][sbTill] += CarInfo[idcar][cValue]/2; // Conce Bajo
PlayerPlayMusic(giveplayerid);
GameTextForPlayer(giveplayerid, "~w~Felicitaciones~n~Utiliza /V Estacionar, Para Parkear Tu Coche!", 5000, 3);
SendClientMessage(giveplayerid, COLOR_GRAD2, "Que Lo Disfrutes!");
SendClientMessage(giveplayerid, COLOR_GRAD2, "Escribe: /Manual, Para Ver Los Comandos Del Coche..!");
SendClientMessage(giveplayerid, COLOR_YELLOW2, "Ya Puedes Encender Tu Coche.. Utilize: /Motor..!");
gEngine[giveplayerid] = 0;
engineOn[GetPlayerVehicleID(giveplayerid)] = false;
DateProp(giveplayerid);
OnPropUpdate();
PlayerUpdate(giveplayerid);
format(string, sizeof(string), "ESET-NOD32: %s (%s)[%d]", sendername, CarInfo[idcar][cDescription]);
ESETPropertyLog(string);
}
else{
SendClientMessage(playerid,COLOR_GRAD2,"Ok , No compraste el auto");
}
}
giveplayerid = ReturnUser(tmp);
// Hay que definir tmp
tmp = strtok(cmdtext,idx);
InfoComprador[playerid] = giveplayerid;
giveplayerid = InfoComprador[playerid];
new persona[MAX_PLAYERS];
persona[getplayerid];
//en el comando
persona[playerid] = giveplayerid ;
//en OnDialogResponse reemplaza ReturnUser(tmp) por la variable
giveplayerid = persona[playerid];
if(strcmp(cmd, "/venderveh", true) == 0)
{
new giveplayerid;
new newcar = GetPlayerVehicleID(playerid);
persona[playerid] = giveplayerid ;
if(NFS(playerid))
{
if (!strlen(persona))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /venderveh [playerid/partOfName]");
return 1;
}
giveplayerid = ReturnUser(persona);
if (giveplayerid == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_GREY, "Jugador Off Line");
return 1;
}
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[giveplayerid][pLevel] < 3)
{
SendClientMessage(playerid, COLOR_GREY, "Necesita Minimo Nivel 3, Para tener Un Coche..!");
return 1;
}
if(CarInfo[newcar][cOwned]==1)
{
SendClientMessage(playerid, COLOR_GREY, "Vendedor: Este Coche Ya Tiene Dueсo, Lo Siento.");
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}
if(PlayerInfo[giveplayerid][pPcarkey] == 999){}
else if(PlayerInfo[giveplayerid][pPcarkey2] == 999) { }
else { SendClientMessage(playerid, COLOR_GREY, "Unicamente Se Permite Tener 2 Coches Por Persona."); return 1; }
if(GetPlayerMoney(giveplayerid) >= CarInfo[idcar][cValue])
{
if(PlayerInfo[giveplayerid][pPcarkey] == 999) { PlayerInfo[giveplayerid][pPcarkey] = idcar; }
else if(PlayerInfo[giveplayerid][pPcarkey2] == 999) { PlayerInfo[giveplayerid][pPcarkey2] = idcar; }
else { return 1; }
ShowPlayerDialog(giveplayerid,2014,DIALOG_STYLE_MSGBOX,"Confirmacion","їDesea Aceptar este auto?","Si","No");
return 1;
}else SendClientMessage(playerid, COLOR_GREY, "Sin Dinero suficiente");
}
} else SendClientMessage(playerid, COLOR_GREY, "No Eres vendedor de autos");
return 1;
}
pawn Код:
|
persona[giveplayerid] = playerid;
giveplayerid = persona[playerid];