Jump to content
  • 0

Jail Ajutor


eXtreMe96

Question

Am comanda de jail

dcmd_jail(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
		if(PlayerInfo[playerid][Level] >= 3) {
		    new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index), tmp3 = strtok(params,Index);
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /jail [playerid] [minutes] [reason]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);

		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
				if(PlayerInfo[player1][Jailed] == 0) {
					GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
					new jtime = strval(tmp2);
					if(jtime == 0) jtime = 9999;

			       	CMDMessageToAdmins(playerid,"JAIL");
					PlayerInfo[player1][JailTime] = jtime*1000*60;
    			    SetTimerEx("JailPlayer",5000,0,"d",player1);
		    	    SetTimerEx("Jail1",1000,0,"d",player1);
		        	PlayerInfo[player1][Jailed] = 1;

					if(jtime == 9999) {
						if(!strlen(params[strlen(tmp2)+1])) format(string,sizeof(string),"Administrator %s has jailed %s ",adminname, playername);
						else format(string,sizeof(string),"Administrator %s has jailed %s [reason: %s]",adminname, playername, params[strlen(tmp)+1] );
   					} else {
						if(!strlen(tmp3)) format(string,sizeof(string),"Administrator %s has jailed %s for %d minutes",adminname, playername, jtime);
						else format(string,sizeof(string),"Administrator %s has jailed %s for %d minutes [reason: %s]",adminname, playername, jtime, params[strlen(tmp2)+strlen(tmp)+1] );
					}
	    			return SendClientMessageToAll(blue,string);
				} else return SendClientMessage(playerid, red, "Player is already in jail");
			} else return SendClientMessage(playerid, red, "Player is not connected or is the highest level admin");
		} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

Vreu sa fac ca cind esti in jail sa nu poti nici o comadna chiar daca esti admin ma puteti ajuta sa o fac

lol

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Adauga deaspura primei comenzi din script, dupa public OnPlayerCommandText(playerid, cmdtext[])

if(PlayerInfo[player1][Jailed] == 1) 
{
    //restu de liniie (comenzile)
Iar dupa ultima comanda pui
} else return SendClientMessage(playerid, red, "Player is already in jail");
Exemplu:
public OnPlayerCommandText(playerid, cmdtext[])
{
    //chestiile cu new daca ai.
    if(PlayerInfo[player1][Jailed] == 1)
    {
        if (strcmp(cmdtext, "/primacomanda", true) == 0)
        {
            SetPlayerPos(playerid,X,Y,Z);
            return 1;
        }
        else return SendClientMessage(playerid, red, "Player is already in jail");
        return 1;
    }
    return 0;
}

Ceva de genul. Am scris-o repede ca ma grabeam si nu m-am uitat daca sunt greseli.

logo.png

ATENTIE!!! Nu imi trimiteti mesaje private care au legatura cu scriptingul. NU mai scriptez.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Similar Content

    • By D3m0n1K
      Buna Seara, descriere problema : cand ajung la dmv si scriu exam, nu imi afiseaza astea, daca doriti pot adauga liniile care este nevoie.
       
       
    • By AndreiiGL
      Salut, am o problema la comanda /work daca ma poate ajuta cineva, sunt incepator.
      https://pastebin.com/RJp8stDV
       
      Erorile:
      C:\Users\Andrei\Downloads\filehost_BLACKWEED (2)\BLACKWEED\gamemodes\1t4p.pwn(31022) : error 014: invalid statement; not in switch
      C:\Users\Andrei\Downloads\filehost_BLACKWEED (2)\BLACKWEED\gamemodes\1t4p.pwn(31022) : warning 215: expression has no effect
      C:\Users\Andrei\Downloads\filehost_BLACKWEED (2)\BLACKWEED\gamemodes\1t4p.pwn(31022) : error 001: expected token: ";", but found ":"
      C:\Users\Andrei\Downloads\filehost_BLACKWEED (2)\BLACKWEED\gamemodes\1t4p.pwn(31022) : error 029: invalid expression, assumed zero
      C:\Users\Andrei\Downloads\filehost_BLACKWEED (2)\BLACKWEED\gamemodes\1t4p.pwn(31022) : fatal error 107: too many error messages on one line
    • By AndreiSAMP2
      :\Users\Karol\Desktop\devised\gamemodes\devised.pwn(12) : fatal error 100: cannot read from file: "AutoAFK"
    • By CristianLMAO
      Salut!
      Codul:
      #include <a_samp> #include <dini> #include <dudb> #include <zcmd> #pragma unused ret_memcpy //colors #define COLOR_GREY 0xAFAFAFAA #define COLOR_GREEN 0x33AA33AA #define COLOR_ORANGE 0xFF9900AA #define COLOR_RED 0xAA3333AA #define COLOR_YELLOW 0xFFFF00AA #define SERVER_USER_FILE "database/users/%s.ini" // users #define SERVER_ALOG_FILE "database/log/adminlogs.txt" // alogs #define gmtext "gold.united-islands.ro | v0.2" #define function%0(%1) forward %0(%1); public %0(%1) main() { } public OnGameModeInit() { SetGameModeText(gmtext); AddPlayerClass(0,1219,-1813.5,16.5,179.5,0,0,0,0,0,0); //spawn bikes CreateVehicle(510, 1237,-1813.2892,13.4315,270, 0, 0, 60); CreateVehicle(510, 1237,-1815.0358,13.4282,270, 0, 0, 60); CreateVehicle(510, 1237,-1816.5765,13.4258,270, 0, 0, 60); CreateVehicle(510, 1237,-1817.9580,13.4233,270, 0, 0, 60); CreateVehicle(510, 1237,-1819.4449,13.4225,270, 0, 0, 60); CreateVehicle(510, 1237,-1820.9550,13.4193,270, 0, 0, 60); CreateVehicle(510, 1237,-1822.3446,13.4148,270, 0, 0, 60); CreateVehicle(510, 1237,-1823.8909,13.4133,270, 0, 0, 60); // pickups CreatePickup(1581, 1, 1214.0170,-1814.4308,16.8, -1); //3d texts Create3DTextLabel("DMV\nScrie '/startexam' pentru a intra in examen! Acest examen costa 500k bani!", 0x00FF00BB, 1214.0170,-1814.4308,16.5, 40, 0, 1); return 1; } public OnGameModeExit(){ } enum pInfo { pCash, pBank, pAdminLevel, pBonusPoints, pScore, pPremium, pMuted, pInDmv, pDmvStage, pCarLic, pBanned } new PlayerInfo[MAX_PLAYERS][pInfo]; new gPlayerLogged[MAX_PLAYERS]; public OnPlayerConnect(playerid) { gPlayerLogged[playerid] = 0; new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if (!dini_Exists(file)) { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Register", "Scrie mai jos parola pe care vrei sa o ai la cont:", "Register", "inchide"); } if(fexist(file)) { ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "Login", "Punte-ti parola mai jos:", "Login", "Leave"); } return 1; } public OnPlayerDisconnect(playerid, reason) { new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(gPlayerLogged[playerid] == 1) { dini_IntSet(file, "Cash", PlayerInfo[playerid][pCash]); dini_IntSet(file, "Bank", PlayerInfo[playerid][pBank]); dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]); dini_IntSet(file, "BonusPoints", PlayerInfo[playerid][pBonusPoints]); dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]); dini_IntSet(file, "Premium",PlayerInfo[playerid][pPremium]); dini_IntSet(file, "Muted",PlayerInfo[playerid][pMuted]); dini_IntSet(file, "InDMV",PlayerInfo[playerid][pInDmv]); dini_IntSet(file, "DmvStage",PlayerInfo[playerid][pDmvStage]); dini_IntSet(file, "Carlic",PlayerInfo[playerid][pCarLic]); dini_IntSet(file, "Banned",PlayerInfo[playerid][pBanned]); } gPlayerLogged[playerid] = 0; return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if (dialogid == 1) { new name[MAX_PLAYER_NAME], file[256], string[128]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(!response) return Kick(playerid); if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Register", "Scrie mai jos parola pe care vrei sa o ai la cont:", "Register", "inchide"); dini_Create(file); dini_IntSet(file, "Cash", PlayerInfo[playerid][pCash] = 1000000); dini_IntSet(file, "Bank", PlayerInfo[playerid][pBank] = 5000); dini_IntSet(file, "Password", udb_hash(inputtext)); dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0); dini_IntSet(file, "BonusPoints",PlayerInfo[playerid][pBonusPoints] = 0); dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 1); dini_IntSet(file, "Premium",PlayerInfo[playerid][pPremium] = 0); dini_IntSet(file, "Muted",PlayerInfo[playerid][pMuted]); dini_IntSet(file, "InDMV",PlayerInfo[playerid][pInDmv] = 1); dini_IntSet(file, "DmvStage",PlayerInfo[playerid][pDmvStage] = 0); dini_IntSet(file, "Carlic",PlayerInfo[playerid][pCarLic]); dini_IntSet(file, "Banned",PlayerInfo[playerid][pBanned]); format(string, 128, "[SYSTEM]: succes registrat numele asta %s, ai intrat autologin.", name); SendClientMessage(playerid, COLOR_YELLOW, string); SpawnPlayer(playerid); gPlayerLogged[playerid] = 1; } if (dialogid == 2) { new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(!response) return Kick(playerid); if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "Login", "Punte-ti parola mai jos:", "Login", "Leave"); new tmp; tmp = dini_Int(file, "Password"); if(udb_hash(inputtext) != tmp) { SendClientMessage(playerid, COLOR_RED, "[SYSTEM] Parola gresita!"); ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "Login", "Punte-ti parola mai jos:", "Login", "Leave"); } else { SpawnPlayer(playerid); gPlayerLogged[playerid] = 1; PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel"); SetPlayerScore(playerid, PlayerInfo[playerid][pScore]); GivePlayerMoney(playerid, dini_Int(file, "Cash")-GetPlayerMoney(playerid)); SendClientMessage(playerid,COLOR_GREEN, "[SYSTEM]: Te-ai logat!"); } } return 1; } public OnPlayerStateChange(playerid, newstate, oldstate){ return 1; } public OnPlayerText(playerid, text[]){ new name[MAX_PLAYER_NAME]; new file[256]; new string[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(dini_Int(file, "Muted") == 1){ format(string, sizeof(string), "You can't talk right now! You are muted."); SendClientMessage(playerid, COLOR_GREY, string); return 0; } else{ return 1; } } public OnPlayerSpawn(playerid) { new name[MAX_PLAYER_NAME]; new file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(dini_Int(file, "InDmv") == 1) { SendClientMessage(playerid, COLOR_GREEN, "Ai picat testul deoarece ai iesit de pe server!"); dini_IntSet(file, "InDmv", PlayerInfo[playerid][pInDmv] = 0); } return 1; } public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { new name[MAX_PLAYER_NAME]; new file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(ispassenger == 0){ if(dini_Int(file, "Carlic") == 0) { SendClientMessage(playerid, COLOR_GREY, "* Nu ai permis de conducere! Scrie /dmv pentru a incepe un curs de conducere"); SlapPlayer(playerid); } } return 1; } public OnPlayerExitVehicle(playerid, vehicleid){ new name[MAX_PLAYER_NAME]; new file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(dini_Int(file, "InDmv") == 1){ DestroyVehicle(vehicleid); dini_IntSet(file, "InDmv", PlayerInfo[playerid][pInDmv] = 0); SendClientMessage(playerid, COLOR_RED, "Deoarece ai iesit din masina testului, ai picat examenul"); } return 1; } public OnPlayerCommandText(playerid, cmdtext[]){ return 0; } stock GetName(playerid){ new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername, MAX_PLAYER_NAME); return playername; } public OnPlayerEnterCheckpoint(playerid){ new name[MAX_PLAYER_NAME]; new file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(dini_Int(file, "DmvStage") == 1){ SetPlayerCheckpoint(playerid, 1311.3917,-1840.5356,12.9904, 10); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 2); } if(dini_Int(file, "DmvStage") == 2){ SetPlayerCheckpoint(playerid, 1326.6887,-1734.6566,12.9904, 10); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 3); } if(dini_Int(file, "DmvStage") == 3){ SetPlayerCheckpoint(playerid, 1526.7543,-1735.5416,12.9904, 10); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 4); } if(dini_Int(file, "DmvStage") == 4){ SetPlayerCheckpoint(playerid, 1526.1432,-1590.6320,12.9904, 10); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 5); } if(dini_Int(file, "DmvStage") == 5){ SetPlayerCheckpoint(playerid, 1406.6301,-1590.2607,12.9650, 10); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 6); } if(dini_Int(file, "DmvStage") == 6){ SetPlayerCheckpoint(playerid, 1314.1741,-1563.0592,12.9904, 10); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 7); } if(dini_Int(file, "DmvStage") == 7){ SetPlayerCheckpoint(playerid, 1359.6761,-1422.0052,12.9904, 10); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 8); } if(dini_Int(file, "DmvStage") == 8){ SetPlayerCheckpoint(playerid, 1278.8462,-1394.5029,12.7273, 10); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 9); } if(dini_Int(file, "DmvStage") == 9){ SetPlayerCheckpoint(playerid, 1208.9016,-1385.4451,12.8471, 10); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 10); } if(dini_Int(file, "DmvStage") == 10){ SetPlayerCheckpoint(playerid, 1216.1479,-1284.8210,12.9904, 10); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 11); } if(dini_Int(file, "DmvStage") == 11){ SetPlayerCheckpoint(playerid, 1310.4785,-1281.9036,12.9904, 10); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 12); } if(dini_Int(file, "DmvStage") == 12){ SetPlayerCheckpoint(playerid, 1313.7811,-1540.7218,12.9961, 10); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 13); } if(dini_Int(file, "DmvStage") == 13){ SetPlayerCheckpoint(playerid, 1309.2744,-1822.3461,12.9904, 10); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 14); } if(dini_Int(file, "DmvStage") == 14){ SetPlayerCheckpoint(playerid, 1272.6282,-1847.5135,12.9977, 10); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 15); } if(dini_Int(file, "DmvStage") == 15){ SetPlayerCheckpoint(playerid, 1271.3938,-1827.1415,12.9922, 10); dini_IntSet(file, "DmvStage", 16); } if(dini_Int(file, "DmvStage") == 16){ DisablePlayerCheckpoint(playerid); dini_IntSet(file, "DmvStage", 0); dini_IntSet(file, "InDMV", 0); dini_IntSet(file, "Carlic", 1); DestroyVehicle(GetPlayerVehicleID(playerid)); } return 0; } //comenzi: CMD:startexam(playerid, params){ new name[MAX_PLAYER_NAME]; new file[256]; new car[1]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(dini_Int(file, "Carlic") == 1) return SendClientMessage(playerid, COLOR_RED, "Deja ai licenta pentru masina!"); if(dini_Int(file, "InDMV") == 1) return SendClientMessage(playerid, COLOR_RED, "Deja esti in examen, daca crezi ca este o problema, poti sa reintri pe server!"); if(dini_Int(file, "Cash") < 500000) return SendClientMessage(playerid, COLOR_RED, "Nu ai suficienti bani pentru a face acest lucru!"); DisablePlayerCheckpoint(playerid); dini_IntSet(file, "Cash", PlayerInfo[playerid][pCash] =dini_Int(file, "Cash")-500000); dini_IntSet(file, "InDMV", PlayerInfo[playerid][pInDmv] = 1); GivePlayerMoney(playerid, dini_Int(file, "Cash")-GetPlayerMoney(playerid)); dini_IntSet(file, "CarLic", PlayerInfo[playerid][pCarLic] = 0); car[0] = CreateVehicle(421, 1267.9502,-1825.6804,13.3818,185.7668, 1, 1, 90000000); PutPlayerInVehicle(playerid, car[0], 0); SetPlayerCheckpoint(playerid, 1269.2395,-1846.8804,13.0048, 10); SendClientMessage(playerid, COLOR_GREEN, "Du-te la checkpoint-uri!"); dini_IntSet(file, "DmvStage", PlayerInfo[playerid][pDmvStage] = 1); return 1; } Cand compilez, nu se intampla nimic, dar in joc, cand intru in checkpoint imi activeaza toate checkpointurile
      Stiu ce am facut gresit, dar nu stiu sa rezolv. 
      Check-pointurile sunt la OnPlayerEnterCheckpoint.
       
      Multumesc!
    • By Tefyuu
      CMD:aduty(playerid, params[])
      {
          if(IsPlayerAdmin(playerid)) 
          {
                      new type[25];
                      
      28971 :        if(sscanf(params, "s[25]", type)) return SendClientMessage(playerid, -1,"Syntax: /aduty <on/off>");
              if(strcmp(type, "off", true) == 0)
              {
                  ResetPlayerWeapons(playerid); 
      28979:                    SetPlayerArmour(playerid, 0); 
                          SetPlayerHealth(playerid, 100); 
                          SetPlayerSkin(playerid, 25); 
      28985:          SendClientMessageToAll(COLOR_RED, "((AdmBot: Unul dintre administratori este acum off duty.))"); 
              }
              else if(strcmp(type, "on", true) == 0)
              {
                          GivePlayerWeapon(playerid, 38, 9999); 
                          SetPlayerArmour(playerid, 9999999); 
                          SetPlayerHealth(playerid, 9999999); 
                          SetPlayerSkin(playerid, 217); 
      29001:            SendClientMessageToAll(COLOR_GREEN, "((AdmBot: Unul dintre administratori este acum on duty.))"); 
              }
          }
          else 
          {
              SendClientMessage(playerid, COLOR_RED, "Eroare: Nu esti un Administrator.");
          }
          return 1;
      }
       
       
       
       
      in aceasta comanda primesc erorile astea 
       
      C:\Users\tefyuu\Desktop\burned.ro\gamemodes\wa-rpg.pwn(28971) : warning 217: loose indentation
      C:\Users\tefyuu\Desktop\burned.ro\gamemodes\wa-rpg.pwn(28979) : warning 217: loose indentation
      C:\Users\tefyuu\Desktop\burned.ro\gamemodes\wa-rpg.pwn(28985) : warning 217: loose indentation
      C:\Users\tefyuu\Desktop\burned.ro\gamemodes\wa-rpg.pwn(29001) : warning 217: loose indentation
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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.