Jump to content

andy47

Membru
  • Posts

    519
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by andy47

  1. Incearca asa: CMD:park ( playerid , params [ ] ) { if ( IsPlayerConnected ( playerid ) ) { new Float: VPos [ 4 ] , key , HouseKey = PlayerInfo [ playerid ] [ pHouseKey ] ; if ( PlayerInfo [ playerid ] [ pPlayerConnected ] == 0 ) return SCM ( playerid , -1 , IsNotConnected ) ; if ( VPersSpawned [ playerid ] == MAX_PERSONALCARS ) return SCM ( playerid , -1 , ""ALB"You need a car so you can park visible." ) ; if ( IsPlayerInAnyVehicle ( playerid ) && ( VPersSpawned [ playerid ] == GetPlayerVehicleID ( playerid ) ) && ( GetPlayerState ( playerid ) == PLAYER_STATE_DRIVER ) ) { GetVehiclePos ( GetPlayerVehicleID ( playerid ) , VPos [ 0 ] , VPos [ 1 ] , VPos [ 2 ] ) ; GetVehicleZAngle ( GetPlayerVehicleID ( playerid ) , VPos [ 3 ] ) ; if ( SlotUSED [ playerid ] == 1 ) { key = PlayerInfo [ playerid ] [ pCarKey1 ] ; } else if ( SlotUSED [ playerid ] == 2 ) { key = PlayerInfo [ playerid ] [ pCarKey2 ] ; } else if ( SlotUSED [ playerid ] == 3 ) { key = PlayerInfo [ playerid ] [ pCarKey3 ] ; } CarInfo [ key ] [ cLocation ] [ 0 ] = VPos [ 0 ] ; CarInfo [ key ] [ cLocation ] [ 1 ] = VPos [ 1 ] ; CarInfo [ key ] [ cLocation ] [ 2 ] = VPos [ 2 ] ; CarInfo [ key ] [ cAngle ] = VPos [ 3 ] ; DestroyVehicle( GetPlayerVehicleID( playerid ) ) ; new car = CreateVehicle(CarInfo[key][ cModel ],CarInfo[key][cLocation][0],CarInfo[key][cLocation][1],CarInfo[key][cLocation][2]+1.0,CarInfo[key][cAngle],CarInfo[key][cColorOne],CarInfo[key][cColorTwo],500000); PutPlayerInVehicle( playerid, car, 0 ) ; mysql_format( gHandle, SQLString, 256, "UPDATE `%s` SET `LocationX`='%f',`LocationY`='%f',`LocationZ`='%f',`Angle`='%f' WHERE `CarID`='%d'", DBNAME_PCARS, CarInfo[ key ][ cLocation ][ 0 ], CarInfo[ key ][ cLocation ][ 1 ], CarInfo[ key ][ cLocation ][ 2 ], CarInfo[ key ][ cAngle ], key ); mysql_tquery( gHandle, SQLString, "", "" ); SCM ( playerid , -1 , ""ALBASTRU"[ INFO ] The car was parked successful in this location." ) ; } } return 1 ; }
  2. Da la "i" ala care l-ai pus tu sa reprezinte cKM .
  3. Cu placere! Problema rezolvata. T/C!
  4. Posteaza OnPlayerSpawn si OnPlayerDeath.
  5. Pai km astia definestei ca un float. Si acolo la update adaugi: new query[MAX_STRING]; format(query, sizeof(query), "UPDATE `cars` SET `KM`='%0.2f' WHERE `id`='%d'", CarData[i-PreVehicle][cKM], i-PreVehicle); mysql_query(query); Mergi la new CarData si acolo deasuprea la enum adaugi inloc de cKM Float:cKM Peste tot unde setezi ca variabila asta sa fie 0 inloc de 0 pui 0.0 exemplu: CarData[i-PreVehicle][cKM] = 0.0; // deoarece e float Mergi la : sscanf(Query, "p<|>e<iiffffffffiis[64]s[64]iiiiis[255]iiiiiiiiiiiiiii>",CarData[idx]); si inlocuieste "i" cu "f" . La textdraw inloc de "%d" inlocuieste cu "%.2f". La functia CheckGas inlocuieste: CarData[i-PreVehicle][cKM]++; cu: CarData[i-PreVehicle][cKM] += (Carspeed(i)*0.27)/700; si functia pentru Carspeed: stock Carspeed(playerid,mode = 1) { new Float:Velocity [3]; GetVehicleVelocity ( GetPlayerVehicleID ( playerid ) , Velocity [ 0 ] , Velocity [ 1 ] , Velocity [ 2 ] ) ; return IsPlayerInAnyVehicle ( playerid ) ? floatround ( ( ( floatsqroot ( ( ( Velocity [ 0 ] * Velocity [ 0 ] ) + ( Velocity [ 1 ] * Velocity [ 1 ] ) + ( Velocity [ 2 ] * Velocity [ 2 ] ) ) ) * ( !mode ? 105.0 : 170.0 ) ) ) * 1 ) : 0; }
  6. Credca folosesti versiune mysql r7+ deoarece vad acolo ca ai erori de la cache_. Intra pe site-ul asta si iati versiune r39-3: https://github.com/pBlueG/SA-MP-MySQL/releases
  7. Ai adaugat aici: sscanf(Query, "p<|>e<iiffffffffiis[64]s[64]iiiiis[255]iiiiiiiiiiiiiii>",CarData[idx]); inca un "i" ?
  8. Foloseste asa cand faci update: mysql_format(gHandle, SQLString, "UPDATE `%s` SET `LocationX`='%f' WHERE `CarID`='%d'",DBNAME_PCARS,CarInfo[ key ][ cLocation ][ 0 ],key); mysql_tquery(gHandle, SQLString, "", "" ) ; Pune ca prima data sa distruga masina unde se afla jucatorul, dupa sa o creeze si sa-l bage inauntru. Folosestete de functiile astea: DestroyVehicle PutPlayerInVehicle CreateVehicle
  9. andy47

    Problema cars

    Credca folosesti system de masini personale a lui I_Bank ( sau cum il cheama ). Cauta in gm new carsonserver = folosind CTRL+F, si inlocuieste cu new carsonserver = 0; daca nu merge cu 0 incearca si cu 1 . Dupa cauti in gm ca ai ceva de genul asta: new CarInfo[254][cInfo]; si inlocuieste 254 cu 0. Masinile trebuie toate sterse din .cfg si dupa faci asta.
  10. Dute la callback-ul OnPlayerExitVehicle si adauga: public OnPlayerExitVehicle(playerid, vehicleid) { PlayAudioStreamForPlayer(playerid, "Radio oprit."); StopAudioStreamForPlayer(playerid); return 1; }
  11. Incearca comanda asta: if(strcmp(cmd, "/sellcar", true) == 0||strcmp(cmd, "/sellboat", true) == 0||strcmp(cmd, "/sellbike", true) == 0||strcmp(cmd, "/sellaero", true) == 0) { if(IsAtDealership(playerid)) { new vehid; if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey1]) { vehid = PlayerInfo[playerid][pPcarkey1]; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { vehid = PlayerInfo[playerid][pPcarkey2]; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { vehid = PlayerInfo[playerid][pPcarkey3]; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey4]) { vehid = PlayerInfo[playerid][pPcarkey4]; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey5]) { vehid = PlayerInfo[playerid][pPcarkey5]; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey6]) { vehid = PlayerInfo[playerid][pPcarkey6]; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey7]) { vehid = PlayerInfo[playerid][pPcarkey7]; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey8]) { vehid = PlayerInfo[playerid][pPcarkey8]; } else { return 1; } new Float:x, Float:y, Float:z, Float:a; GetVehiclePos(vehid, x, y, z); GetVehicleZAngle(vehid, a); GetPlayerName(playerid, sendername, sizeof(sendername)); if(strcmp(sendername, CarInfo[vehid][cOwner], true) == 0) { new vehi = GetPlayerVehicleID(playerid); new carsellprice = CarInfo[vehid][cValue] / 2; format(string, sizeof(string), "~w~ai vandut masina pentru: ~n~~g~$%d", carsellprice); GameTextForPlayer(playerid, string, 1000, 3); strmid(CarInfo[vehid][cOwner], "None", 0, strlen("None"), 999); strmid(CarInfo[vehid][cDescription], "None", 0, strlen("None"), 999); strmid(CarInfo[vehid][cNume], "None", 0, strlen("None"), 999); CarInfo[vehid][cModel] = 0; CarInfo[vehid][cLocationx] = 0.0; CarInfo[vehid][cLocationy] = 0.0; CarInfo[vehid][cLocationz] = 0.0; CarInfo[vehid][cAngle] = 0.0; CarInfo[vehid][cColorOne] = 0; CarInfo[vehid][cColorTwo] = 0; CarInfo[vehid][cValue] = 0; CarInfo[vehid][cLicense] = 0; CarInfo[vehid][cOwned] = 0; CarInfo[vehid][cLock] = 0; CarInfo[vehid][cOras] = 0; CarInfo[vehid][cNumar] = 0; CarInfo[vehid][cMod1] = 0; CarInfo[vehid][cMod2] = 0; CarInfo[vehid][cMod3] = 0; CarInfo[vehid][cMod4] = 0; CarInfo[vehid][cMod5] = 0; CarInfo[vehid][cMod6] = 0; CarInfo[vehid][cMod7] = 0; CarInfo[vehid][cMod8] = 0; CarInfo[vehid][cMod9], = 0; CarInfo[vehid][cMod10] = 0; CarInfo[vehid][cMod11] = 0; CarInfo[vehid][cMod12] = 0; CarInfo[vehid][cMod13] = 0; CarInfo[vehid][cMod14] = 0; CarInfo[vehid][cMod15] = 0; CarInfo[vehid][cMod16] = 0; CarInfo[vehid][cMod17] = 0; CarInfo[vehid][cPaintJob] = 0; CarInfo[vehid][cDist] = 0; CarInfo[vehid][cLockTrunk] = 0; CarInfo[vehid][cAlarmInst] = 0; CarInfo[vehid][cAlarm] = 0; CarInfo[vehid][cDate ] = 0; CarInfo[vehid][cNeon] = 0; CarInfo[vehid][cNeonActiv] = 0; CarInfo[vehid][cBass] = 0; RemovePlayerFromVehicle(playerid); DestroyVehicle(vehi); OnPropUpdate(); OnPlayerUpdateEx(playerid); SafeGivePlayerMoney(playerid,carsellprice); if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey1]) { PlayerInfo[playerid][pPcarkey1] = 9999; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { PlayerInfo[playerid][pPcarkey2] = 9999; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { PlayerInfo[playerid][pPcarkey3] = 9999; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey4]) { PlayerInfo[playerid][pPcarkey4] = 9999; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey5]) { PlayerInfo[playerid][pPcarkey5] = 9999; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey6]) { PlayerInfo[playerid][pPcarkey6] = 9999; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey7]) { PlayerInfo[playerid][pPcarkey7] = 9999; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey8]) { PlayerInfo[playerid][pPcarkey8] = 9999; } TogglePlayerControllable(playerid, 1); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " Nu esti in masina ta! "); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, "Nu esti la centrul de vanzare"); return 1; } }
  12. Din cate am inteles eu tu vrei ca sa stergi masina de pe server cand ii da /sellcar?
  13. Posteaza loadarea masinilor poate ai gresit pe acolo.
  14. Pai trebuie sa faci ca sa se poata salva undeva masinile si cand dai restart ele se vor incarca automat acolo unde le-ai parcat. Verifica si posteaza OnPropUpdate(); poate nu ai pus sa le salveze.
  15. enum { DIALOG_ASHOP } CMD:ashop(playerid,params[]) { if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first."); if (PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid,COLOR_WHITE,AdminOnly); { ShowPlayerDialog(playerid, DIALOG_ASHOP, DIALOG_STYLE_LIST, "Admin shop:", "Clear FP", "Select", "Close"); } return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if ( dialogid == DIALOG_ASHOP ) { if ( response ) { switch ( listitem ) { case 0: { new id,fp; PlayerInfo[id][pFpunish] = 0; Update(id,pFpunishx); SendClientMessage(playerid, COLOR_YELLOW, "Faction-Punishul tau a fost sters cu succes".); } } } } return 1; }
  16. Fa update la pluginul mysql si la libmysql. Si vezi tu daca folosesti r7 nu pune pluginul si libu pentru r39. https://github.com/pBlueG/SA-MP-MySQL/releases
  17. Text-ul pe care l-ai pus tu e prea mare. Foloseste strcat. Exemplu: if(strcmp(cmd, "/factiuni", true) == 0) { if(IsPlayerConnected(playerid)) { new string[ 2000 ] ; strcat(string,"Bla bla bla " ) ; strcat(string,"Bla bla bla " ) ; strcat(string,"Bla bla bla " ) ; strcat(string,"Bla bla bla " ) ; ShowPlayerDialog(playerid,13310,DIALOG_STYLE_MSGBOX,"Factiuni:",string,"Ok",""); } return 1; }
  18. Respecta modelul. Topic inchis!
  19. Ti-am dat un exemplu daca vrei numai pune sa verifice daca e membru pd.
  20. Pai poti sa pui la OnPlayerDeath ca daca la omorat un membru PD ( de exemplu ) sa ii setezi variabila pe care o folosesti tu sa verifice daca e in jail, pe 1, iar la OnPlayerSpawn pui sa verifice daca variabila pentru jail e egala cu unu sa-l spawneaza in jail daca nu,nu se va intampla nimic. Iti arat si un exemplu mai jos: new Jailed[ MAX_PLAYERS ]; // creem o variabila cu care verificam daca ii dam jail public OnPlayerDeath( playerid, killerid, reason) { if ( pMember[ killerid ] == 1 ) // cu aceasta verifici daca e membru pd | aceasta este o varibila creata de mine tu ai altfel in gamemode { Jailed[ playerid ] = 1; } return ( true ) ; } public OnPlayerSpawn( playerid ) { if ( Jailed[ playerid ] == 1 ) // verifica daca are jailed 1 { // Aici pui codul ca sa-l dea in jail } return ( true ) ; }
  21. La fiecare cache_get_field_content_int adauga acel "Handle" si vezi poate nu ai versiunea buna de mysql. PaccInfo[playerid][Deaths] = cache_get_field_content_int(0, "Deaths", Handle);
  22. Probabil masina este incuiata. Cauta prin gm o comanda ca sa o poti deschide sau modifica in script ca sa fie dechise cand se spawneaza.
  23. Erorile sunt din cauza ca tu n-ai functilea alea in gamemode/filterscripts. N-ai ce face,decat sa le creezi tu.
  24. Acuma trebuie sa-ti mearga am scapat ceva pe acolo . http://www.solidfiles.com/d/0a085f3a39/Untitled.pwn
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.