public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 67 && response == 1)//login { new tmp = dini_Int(User[playerid][pFile], "HPassword"); if(!strlen(inputtext[0])) return SendClientMessage(playerid, COLOR_RED, "[SYSTEM]: /login [password]"); if(!dini_Exists(User[playerid][pFile])) return SendClientMessage(playerid, COLOR_RED, "[SYSTEM]: You are not registered!"); if(logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "[SYSTEM]: You are already logged in!"); if(udb_hash(inputtext[0]) != tmp) { format(String, 256, "You specified the wrong password for %s!You are being Kicked.", User[playerid][pName]); SendClientMessage(playerid, COLOR_RED, String); Kick(playerid); } else { logged[playerid] = 1; format(String, sizeof(String), "Welcome~n~~r~%s",User[playerid][pName]); GameTextForPlayer(playerid, String, 6000, 1); User[playerid][pAdminLevel] = dini_Int(User[playerid][pFile], "AdminLevel"); User[playerid][px] = dini_Float(User[playerid][pFile], "z"); User[playerid][py] = dini_Float(User[playerid][pFile], "y"); User[playerid][pz] = dini_Float(User[playerid][pFile], "z"); User[playerid][pLicense] = dini_Int(User[playerid][pFile], "License"); User[playerid][pScore] = dini_Int(User[playerid][pFile], "Score"); User[playerid][pMoney] = dini_Int(User[playerid][pFile], "Money"); SetPlayerScore(playerid, User[playerid][pScore]); new lebel = User[playerid][pAdminLevel]; SetPlayerPos(playerid,User[playerid][px],User[playerid][py],User[playerid][pz]); ResetPlayerMoney(playerid); GivePlayerMoney(playerid,User[playerid][pMoney]); AllowTele[playerid]=1; format(String, 256, "[SYSTEM]: Successfully logged in! (level: %d)!", lebel); SendClientMessage(playerid,COLOR_RED, String); printf("%s (%i) logged in with password %s", User[playerid][pName], playerid, inputtext[0]); } return 1; } if(dialogid == 70 && response == 1)//register { if(!strlen(inputtext[0])) SendClientMessage(playerid, COLOR_RED, "[SYSTEM]: /register [password]"); if(dini_Exists(User[playerid][pFile])) SendClientMessage(playerid, COLOR_RED, "[SYSTEM]: You are already registered!"); else { dini_Create (User[playerid][pFile]); dini_IntSet (User[playerid][pFile], "HPassword", udb_hash(inputtext[0])); dini_Set (User[playerid][pFile], "Password", inputtext[0]); dini_IntSet (User[playerid][pFile], "Interior",0); dini_IntSet (User[playerid][pFile], "AdminLevel",0); dini_IntSet (User[playerid][pFile], "Score", 0); dini_IntSet (User[playerid][pFile], "License", 0); dini_IntSet (User[playerid][pFile], "Money", 10000); User[playerid][pAdminLevel] = dini_Int(User[playerid][pFile], "AdminLevel"); User[playerid][px] = dini_Float(User[playerid][pFile], "z"); User[playerid][py] = dini_Float(User[playerid][pFile], "y"); User[playerid][pz] = dini_Float(User[playerid][pFile], "z"); User[playerid][pLicense] = dini_Int(User[playerid][pFile], "License"); User[playerid][pScore] = dini_Int(User[playerid][pFile], "Score"); User[playerid][pMoney] = dini_Int(User[playerid][pFile], "Money"); ResetPlayerMoney(playerid); GivePlayerMoney(playerid,User[playerid][pMoney]); //dini_IntSet(file, "job1", 0);dini_IntSet(file, "job2", 0);dini_IntSet(file, "job3", 0);dini_IntSet(file, "job4", 0); format(String, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s", User[playerid][pName], inputtext[0]); SendClientMessage(playerid, COLOR_YELLOW, String); logged[playerid] = 1; SetPlayerPos(playerid, 1742.948242,-1860.797973,13.578297); SendClientMessage(playerid, COLOR_YELLOW, "[SYSTEM]: You have been automatically logged in!"); } return 1; } } |
public OnPlayerStateChange(playerid,newstate,oldstate) { new vehicle; vehicle = GetPlayerVehicleID(playerid); if(newstate==PLAYER_STATE_DRIVER) { if(User[playerid][pLicense]==0) RemovePlayerFromVehicle(playerid),SendClientMessag e(playerid, COLOR_RED, "You do not have a license to operate this vehicle, Book a driving test at the front desk of the DMV"); else if(User[playerid][pLicense]==3 && vehicle<=4) RemovePlayerFromVehicle(playerid),SendClientMessag e(playerid, COLOR_RED, "You are not authorized to drive this government vehicle"); else if(User[playerid][pLicense]==1 && vehicle<=4) SetPlayerRaceCheckpoint(playerid,0, 1556.22, -1838.86, 13.55, 1567.05, -1862.33, 13.38, 3.0); else if(User[playerid][pLicense]==1 && vehicle>4) RemovePlayerFromVehicle(playerid),SendClientMessag e(playerid, COLOR_RED, "You do not have a license to operate this vehicle, Book a driving test at the front desk of the DMV"); } else if(User[playerid][pLicense]==1 && vehicle<=4) { if(oldstate==PLAYER_STATE_DRIVER && newstate==PLAYER_STATE_ONFOOT) { User[playerid][pLicense]=0, DisablePlayerRaceCheckpoint(playerid); SendClientMessage(playerid, COLOR_RED, "You have exited the test car, you have failed"); SendClientMessage(playerid, COLOR_RED, "To take the test again re-book at the front desk of the DMV"); } } return 1; } |
if(User[playerid][pLicense]==0) RemovePlayerFromVehicle(playerid),SendClientMessag e(playerid, COLOR_RED, "You do not have a license to operate this vehicle, Book a driving test at the front desk of the DMV"); |
else if(User[playerid][pLicense]==3 && vehicle<=4) RemovePlayerFromVehicle(playerid),SendClientMessag e(playerid, COLOR_RED, "You are not authorized to drive this government vehicle"); |
else if(User[playerid][pLicense]==1 && vehicle<=4) SetPlayerRaceCheckpoint(playerid,0, 1556.22, -1838.86, 13.55, 1567.05, -1862.33, 13.38, 3.0); |
else if(User[playerid][pLicense]==1 && vehicle>4) RemovePlayerFromVehicle(playerid),SendClientMessag e(playerid, COLOR_RED, "You do not have a license to operate this vehicle, Book a driving test at the front desk of the DMV"); |
"You do not have a license to operate this vehicle, Book a driving test at the front desk of the DMV") |
else if(User[playerid][pLicense]==1 && vehicle<=4) { if(oldstate==PLAYER_STATE_DRIVER && newstate==PLAYER_STATE_ONFOOT) { User[playerid][pLicense]=0, DisablePlayerRaceCheckpoint(playerid); SendClientMessage(playerid, COLOR_RED, "You have exited the test car, you have failed"); SendClientMessage(playerid, COLOR_RED, "To take the test again re-book at the front desk of the DMV"); } } |
#include <a_samp> #include <Dini> #include <colors> #include <Dudb> #include <Dutils> #include <zcmd> #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1 enum pInfo { pAdminLevel, pCash, pScore, pLevel, pJob, pCar, pHouse, Floatx, Floaty, Floatz, FloatAngle, pFile[50], pLicense, pName, pMoney } new AllowTele[MAX_PLAYERS]=1,AntiSpam[MAX_PLAYERS]=0,Car[500],CtrArray[MAX_PLAYERS],Amount,Interior,Tele,Type,logged[MAX_PLAYERS],Model,Total,User[MAX_PLAYERS][pInfo],Float,Float:y,Float:z,Float:Angle,Text:welcomeT ext, CarDB[15] ="DB/Cars.ini", /*WeaponDB[20] ="DB/Weapons.ini",*/ PickupDB[20] ="DB/Pickups.ini", Cars[15] ="Load/Cars.ini", Pickups[30] ="Load/Pickups.ini", CP[30] ="Load/Checkpoints.ini"; new name[MAX_PLAYER_NAME],String[256]; new Text:SPEEDOS[MAX_PLAYERS],Pickup[200]; |
dini_Create (User[playerid][pFile]); dini_IntSet (User[playerid][pFile], "HPassword", udb_hash(inputtext[0])); dini_Set (User[playerid][pFile], "Password", inputtext[0]); dini_IntSet (User[playerid][pFile], "Interior",0); dini_IntSet (User[playerid][pFile], "AdminLevel",0); dini_IntSet (User[playerid][pFile], "Score", 0); dini_IntSet (User[playerid][pFile], "License", 0); dini_IntSet (User[playerid][pFile], "Money", 10000); User[playerid][pAdminLevel] = dini_Int(User[playerid][pFile], "AdminLevel"); User[playerid][px] = dini_Float(User[playerid][pFile], "z"); User[playerid][py] = dini_Float(User[playerid][pFile], "y"); User[playerid][pz] = dini_Float(User[playerid][pFile], "z"); User[playerid][pLicense] = dini_Int(User[playerid][pFile], "License"); User[playerid][pScore] = dini_Int(User[playerid][pFile], "Score"); User[playerid][pMoney] = dini_Int(User[playerid][pFile], "Money"); |