Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Bueno esta vez vengo a dejarles el sistema de ganzuas que hice... EMPEZEMOS!
- Lo primero sera ir a new PlayerInfo[MAX_PLAYERS][pInfo]; y definir pGanzua...
- [pawn]enum pInfo
- {
- pGanzua,
- //demas cosas
- };
- new PlayerInfo[MAX_PLAYERS][pInfo];[/pawn]
- Esto es para definir el pGanzua y no os diga undefinide simbol pGanzua
- Luego buscamos public OnPlayerConnect(playerid) y volvemos a definir pGanzuas. Este paso es para que se guarden las ganzuas.
- [pawn]public OnPlayerConnect(playerid)
- {
- PlayerInfo[playerid][pGanzua] = 0;
- //demas cosas[/pawn]
- Luego en public OnPlayerRegister ponemos esto
- [pawn]format(var, 64, "Ganzuas=%d\n",PlayerInfo[playerid][pGanzua]);fwrite(hFile, var);[/pawn]
- Mas abajo en public OnPlayerUpdate tendremos que volver a definirlo
- [pawn]format(var, 64, "Ganzuas=%d\n",PlayerInfo[playerid][pGanzua]);fwrite(hFile, var);[/pawn]
- Ahora buscaremos public OnPlayerLogin y aƱadimos esto
- [pawn]if( strcmp( key , "Ganzuas" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pGanzua] = strval( val ); }[/pawn]
- [color=#40BF40]EXPLICACION:[/color]
- Todo lo que hemos echo hasta ahora es para definir las ganzuas y para que se guarden en las cuentas de usuarios.
- Bueno, ahora pasamos al comando /Puente
- [spoiler][pawn]if (strcmp(cmd, "/Puente", true) == 0)
- {
- if(PlayerInfo[playerid][pGanzua] == 0)//esto es para definir si no tienen ganzuas
- {
- SendClientMessage(playerid, COLOR_GREY, " No tienes ganzuas para hacer un puente!");//este es el mensaje que saldra si no las tienen
- return 1;
- }
- if(!engineOn[GetPlayerVehicleID(playerid)])
- {
- if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
- {
- return 1;
- }
- if(CarInfo[idcar][cOwned]==0)
- {
- SendClientMessage(playerid, COLOR_GRAD2, "No puedes robar vehiculos en venta!");
- return 1;
- }
- if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
- {
- return 1;
- }
- if(idcar == 59 || idcar == 60)
- {
- return 1;
- }
- if(idcar >= 135 && idcar <= 154)
- {
- return 1;
- }
- if(IsAPlane(idcar))
- {
- return 1;
- }
- if(IsAHarvest(idcar))
- {
- return 1;
- }
- if(IsADrugHarvest(idcar))
- {
- return 1;
- }
- if(IsASweeper(idcar))
- {
- return 1;
- }
- if(IsAGarbage(idcar))
- {
- return 1;
- }
- if(gEngine[playerid] == 1)
- {
- return 1;
- }
- new playerveh = GetPlayerVehicleID(playerid);
- PutPlayerInVehicle(playerid, playerveh, 0);
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "* %s toma una ganzua del bolsillo", sendername);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- SetTimerEx("robovehiculo",3500,0,"i",playerid);
- GameTextForPlayer(playerid, "~w~Robando Vehiculo...",3500,3);
- PlayerInfo[playerid][pGanzua] -= 1;
- gEngine[playerid] = 1;
- }
- return 1;
- }[/pawn][/spoiler]
- Aqui hay poca explicacion la verdad.....
- [pawn]if(PlayerInfo[playerid][pGanzua] == 0)
- {
- SendClientMessage(playerid, COLOR_GREY, " No tienes ganzuas para hacer un puente!");
- return 1;
- }[/pawn]
- Esto es para que si no tienes ganzuas logicamente no te deje hacer el puente xDD. Lo restante es lo mismo que el /motor.
- Ahora crearemos el comando para que compren las ganzuas los mecanicos
- [pawn]if(strcmp(cmdtext, "/comprarganzuas", true) == 0)
- {
- if(PlayerInfo[playerid][pMember] == 10||PlayerInfo[playerid][pLeader] == 10)//faccion que puede usar el cmd
- {
- GivePlayerMoney(playerid, - 500);//dinero que te quita
- PlayerInfo[playerid][pGanzua] += 10;//cantidad de ganzuas que compras
- format(string, sizeof(string), "* %s Compra 10 Ganzuas", sendername);//Mensaje que te saldra
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "No eres Mecanico");//mensaje que saldra si no eres de la faccion
- }
- return 1;
- }[/pawn]
- Y para terminar nos falta la segunda parte del /puente...
- [spoiler][pawn]forward robovehiculo(playerid)
- public robovehiculo(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- new RandomStart;
- new string[256];
- new sendername[MAX_PLAYER_NAME];
- RandomStart = random(4);
- switch(RandomStart)
- {
- case 0,1,2:
- {
- engineOn[GetPlayerVehicleID(playerid)] = true;
- TogglePlayerControllable(playerid, true);
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "* %s Usa su ganzua e intenta encender el vehiculo y lo logra.", sendername);
- ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
- format(string, sizeof(string), "* %s Enciende el motor del vehiculo.", sendername);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- format(string, sizeof(string), "* %s Guarda su ganzua en el bolsillo.", sendername);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- gEngine[playerid] = 0;
- }
- case 3:
- {
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "* %s Usa su ganzua e intenta encender el vehiculo y Falla.", sendername);
- ProxDetector(30.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
- format(string, sizeof(string), "* %s Ha echo mucha fuerza y se ah roto la ganzua.", sendername);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- gEngine[playerid] = 0;
- Alambre[playerid] = 0;
- }
- }
- }
- else
- {
- gEngine[playerid] = 0;
- }
- }
- return 1;
- }[/pawn][/spoiler]
- Aqui os dejo un comando para ver las ganzuas que teneis:
- [pawn]if(strcmp(cmd, "/verganzuas", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- format(string, sizeof(string), " Usted tiene $%d ganzuas en su poder.",PlayerInfo[playerid][pGanzua]);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- }
- return 1;
- }[/pawn]
- Bueno esto seria algo improvisado pero si quereis que al poner /cuenta te salgan las ganzuas que tienes lo hacemos de esta manera
- Vamos a ShowStats y ponemos esto
- [pawn]new ganzuas = PlayerInfo[targetid][pGanzua];[/pawn]
- Mas o menos asi
- [pawn]public ShowStats(playerid,targetid)
- {
- if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
- {
- new ganzuas = PlayerInfo[targetid][pGanzua];[/pawn]
- Esto sirve para definir ganzuas como pGanzua ya que con pGanzua nos daria error
- Ahora vamos a donde tenemos todos los datos del /cuenta y aƱadimos esto
- format(coordsstring, sizeof(coordsstring), " Ganzuas [%d]", ganzuas);
- SendClientMessage(playerid, COLOR_GRAD1,coordsstring);
- Y ya tendriamos todo
- Bueno creo que no hay que explicar mucho mas pero si alguien necesita cualquier aclaracion que me avise y se lo explico
- [color=#FF4000]Si vienes a criticar no pierdas tu tiempo posteando tonterias....[/color]
- CREDITOS:
- [spoiler]Todo para mi xD
- (Menos el /puente que como ya dije es el /motor modificado)[/spoiler]
- Suerte :bien2:
Advertisement
Add Comment
Please, Sign In to add comment