Pomoc oko jail komande za policajca ne admina!

Započeo [BW]fitiLj., Jul 02, 2010, 18:24:29 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

e ovako ko mi ovo bude uradio bice admin lvl 3 ili 4 na mom serveru posto mi je ovo komanda koju nemogu da resim :(

e ovako ocku komandu jail i imam je ali treba mi da radi samo kada su igraci jako blizu a ne kao sto sada moze naprimer ja sam u ls a neko u lv i ja mogu da ga jail e ne tako nego da mogu da ga jail samo ako je blizu mene!

if(strcmp(cmd, "/sajjail", true) == 0) {//UPDATED JAIL CMD ONlY JAILS IF THE SPECIFIED PERSON ISNT JAILED!

                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp)) {
                        SendClientMessage(playerid, COLOR_GREEN, "Usage: /jail [Player ID]");
                        return 1;
                }
giveplayerid = strval(tmp);

if(jailed[giveplayerid]==0) {
        if (gTeam[playerid] == TEAM_COP) {
            if (IsPlayerConnected(giveplayerid)) {

GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "You have been jailed by %s!", sendername, playerid);
      SendClientMessage(giveplayerid, COLOR_RED1, string);
                    format(string, sizeof(string), "%s has been jailed by %s!", giveplayer, giveplayerid, sendername, playerid);
                    SendClientMessageToAll(COLOR_RED1, string);
                    printf(string);
                    SetPlayerInterior(giveplayerid,3);
jailed[giveplayerid] = 1;
    SetPlayerPos(giveplayerid,198.3797,160.8905,1003.0300);
    GivePlayerMoney(playerid, 5000);
        SetPlayerFacingAngle(giveplayerid,177.0350);
            SetCameraBehindPlayer(giveplayerid);
              PlayerPlaySound(giveplayerid,1082,198.3797,160.8905,1003.0300);
                TogglePlayerControllable(giveplayerid,0);   //So the player that is jailed can't use /kill
                  DisablePlayerCheckpoint(giveplayerid);
                return 1;
                                        }else{
        format(string, sizeof(string), "id %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
                }else{
        format(string, sizeof(string), "You are not a cop why are you trying to jail", giveplayerid);
        SendClientMessage(playerid, COLOR_YELLOW, string);
}
}else{
format(string, sizeof(string), "Someone already jailed that player", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);

}

return 1;
}


if(strcmp(cmd, "/sajunjail", true) == 0) {//UPDATED UNJAIL CMD ONly UNJAILS IF THE SPECIFIED PERSON IS JAILED!

                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp)) {
                        SendClientMessage(playerid, COLOR_GREEN, "Usage: /unjail [Player ID]");
                        return 1;
                }
        giveplayerid = strval(tmp);
if(jailed[giveplayerid]==1) {
        if (gTeam[playerid] == TEAM_COP) {
            if (IsPlayerConnected(giveplayerid)) {
                      GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                      GetPlayerName(playerid, sendername, sizeof(sendername));
                                format(string, sizeof(string), "You have been unjailed by %s (ID:%d)!", sendername, playerid);
                                SendClientMessage(giveplayerid, COLOR_GREEN, string);
                                format(string, sizeof(string), "%s (ID:%d) has been unjailed by %s (ID:%d)", giveplayer, giveplayerid, sendername, playerid);
                                SendClientMessageToAll(COLOR_GREEN, string);
                                printf(string);
                                jailed[giveplayerid] = 0;
SetPlayerInterior(giveplayerid,0);
                                SetPlayerFacingAngle(giveplayerid,90.00);
                                SetPlayerPos(giveplayerid,2296.4031,2468.7754,10.8203);
                                SetPlayerFacingAngle(giveplayerid,177.0350);
                                SetCameraBehindPlayer(giveplayerid);
                                TogglePlayerControllable(giveplayerid,1);
                                return 1;
                                        }else{
        format(string, sizeof(string), "id %d Is not even online Dumbass!!", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
                }else{
        format(string, sizeof(string), "You Can't unjail when your not a cop", giveplayerid);
        SendClientMessage(playerid, COLOR_WHITE, string);
}
}else{
format(string, sizeof(string), "This person Is already unjailed", giveplayerid);
SendClientMessage(playerid, COLOR_WHITE, string);
}

return 1;
}

Napravi recimo komandu /ajail putem koje ce admini jailati igrace...

Evo ti iz LA:RPa.


if(strcmp(cmd, "/ajail", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ajail [playerid/PartOfName] [time(minutes)] [reason]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
    if(IsPlayerConnected(playa))
    {
        if(playa != INVALID_PLAYER_ID)
        {
        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ajail [playerid/PartOfName] [time(minutes)] [reason]");
return 1;
}
format(string, sizeof(string), "* You Jailed %s.", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "* You were Jailed by Admin %s.", sendername);
SendClientMessage(playa, COLOR_LIGHTRED, string);
SafeResetPlayerWeapons(playa);
WantedPoints[playa] = 0;
PlayerInfo[playa][pJailed] = 1;
PlayerInfo[playa][pJailTime] = money*60;
SetPlayerInterior(playa, 6);
PlayerInfo[playa][pInt] = 6;
SetPlayerPos(playa, 264.6288,77.5742,1001.0391);
format(string, sizeof(string), "You are jailed for %d minutes.   Bail: Unable", money);
SendClientMessage(playa, COLOR_WHITE, string);
format(string, 256, "AdmCmd: %s has been jailed by Admin %s [Reason: %s]", giveplayer, sendername, (result));
BroadCast(COLOR_LIGHTRED,string);
format(string, sizeof(string), "AdmCmd: %s has been Admin-jailed by %s [Reason: %s]", giveplayer, sendername, (result));
printf("%s",string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
}
}
return 1;
}


/jail ostavi kak je  :)
Respekt: [H]265, John, [03]Garsino, LordShigi, Dujma, Carlsson, Randy, Jacobs, Hu5o, Toni, Lukas, Curtis, Ivo, Hawks, Jack, Koksildo, gonss

Haha OMG => http://zaslike.com/files/9rd5urq94yqagvdsx3i.png [ovo nema nigdje]

ma netreba mi komanda za admina nego igraca znaci samo mi treba da mogu da ga jailujem ako sam jedno 5metara od igraca! :) :D ako je to moguce

Valjda ces skuzit..

if(IsPlayerConnected(giveplayerid))
    {
        if(giveplayerid!= INVALID_PLAYER_ID)
        {
            new Float:x, Float:y, Float:z;
            GetPlayerPos(giveplayerid,x,y,z);
            if(PlayerToPoint(5, playerid, x, y, z))
            {
Aequam memento rebus in arduis servare mentem.

new suspect = GetClosestPlayer(playerid);
if(GetDistanceBetweenPlayers(playerid,suspect) < 5)


To moras koristit, to bi ti izgledalo ovako nekako...

if(strcmp(cmd, "/ajail", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ajail [playerid/PartOfName] [time(minutes)] [reason]");
return 1;
}
new playa;
new money;
                        new suspect = GetClosestPlayer(playerid);
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
                        if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
{
    if(IsPlayerConnected(playa))
    {
        if(playa != INVALID_PLAYER_ID)
        {
        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ajail [playerid/PartOfName] [time(minutes)] [reason]");
return 1;
}
format(string, sizeof(string), "* You Jailed %s.", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "* You were Jailed by Admin %s.", sendername);
SendClientMessage(playa, COLOR_LIGHTRED, string);
SafeResetPlayerWeapons(playa);
WantedPoints[playa] = 0;
PlayerInfo[playa][pJailed] = 1;
PlayerInfo[playa][pJailTime] = money*60;
SetPlayerInterior(playa, 6);
PlayerInfo[playa][pInt] = 6;
SetPlayerPos(playa, 264.6288,77.5742,1001.0391);
format(string, sizeof(string), "You are jailed for %d minutes.   Bail: Unable", money);
SendClientMessage(playa, COLOR_WHITE, string);
format(string, 256, "AdmCmd: %s has been jailed by Admin %s [Reason: %s]", giveplayer, sendername, (result));
BroadCast(COLOR_LIGHTRED,string);
format(string, sizeof(string), "AdmCmd: %s has been Admin-jailed by %s [Reason: %s]", giveplayer, sendername, (result));
printf("%s",string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Nisi blizu toga igraca.");
}
}
return 1;
}


Isprobaj pa reci dal radi.  ::)
Respekt: [H]265, John, [03]Garsino, LordShigi, Dujma, Carlsson, Randy, Jacobs, Hu5o, Toni, Lukas, Curtis, Ivo, Hawks, Jack, Koksildo, gonss

Haha OMG => http://zaslike.com/files/9rd5urq94yqagvdsx3i.png [ovo nema nigdje]

jbg izbaci mi 10 errora aj nema veze ako mi neko pomogne preko ove moj komande pls ako moze

Citat: [AdmTeam]_jovan poslato Jul 03, 2010, 11:12:35 PRE PODNE
jbg izbaci mi 10 errora aj nema veze ako mi neko pomogne preko ove moj komande pls ako moze

postaj errore da resimo

C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(135) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(460) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(480) : warning 202: number of arguments does not match definition
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(501) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(542) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(565) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(577) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(618) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(659) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(683) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(695) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(736) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(777) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(826) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(907) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(948) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(963) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(975) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(975) : error 017: undefined symbol "GetClosestPlayer"
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(976) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(976) : error 017: undefined symbol "ReturnUser"
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(979) : warning 217: loose indentation
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(979) : error 017: undefined symbol "GetDistanceBetweenPlayers"
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(1006) : error 017: undefined symbol "COLOR_LIGHTRED"
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(1008) : error 017: undefined symbol "COLOR_LIGHTRED"
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(1009) : error 017: undefined symbol "SafeResetPlayerWeapons"
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(1010) : error 017: undefined symbol "WantedPoints"
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(1010) : warning 215: expression has no effect
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(1010) : error 001: expected token: ";", but found "]"
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(1010) : error 029: invalid expression, assumed zero
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(1010) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


10 Errors.

Poslednja Izmena: Jul 03, 2010, 11:59:19 PRE PODNE od [AdmTeam]_jovan

Stavi na kraj mode:

forward GetClosestPlayer(p1);
public GetClosestPlayer(p1)
{
new x,Float:dis,Float:dis2,player;
player = -1;
dis = 99999.99;
for (x=0;x<MAX_PLAYERS;x++)
{
if(IsPlayerConnected(x))
{
if(x != p1)
{
dis2 = GetDistanceBetweenPlayers(x,p1);
if(dis2 < dis && dis2 != -1.00)
{
dis = dis2;
player = x;
}
}
}
}
return player;
}


Na pocetak mode: #pragma tabsize 0

Na pocetak mode: #define COLOR_LIGHTRED 0xFF6347AA

Postaj nam liniju 1010

Stavi umjesto Saferestplayerweapons : ResetPlayerWeapons

Obrisi: WantedPoints[playa] = 0;

Stavi na kraj gamemodea:

forward Float:GetDistanceBetweenPlayers(p1,p2);
public Float:GetDistanceBetweenPlayers(p1,p2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
{
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x2,y2,z2);
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}


Moja preporuka: Nemoj radit mode od 0, jer znas 0%!
Aequam memento rebus in arduis servare mentem.

nije GM nego FS
{
to je red 1010 a evo ti errori ima ih sada jos 6
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(501) : warning 202: number of arguments does not match definition
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(997) : error 017: undefined symbol "ReturnUser"
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(1000) : error 017: undefined symbol "GetDistanceBetweenPlayers"
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(1030 -- 1031) : error 076: syntax error in the expression, or invalid function call
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(1031) : error 017: undefined symbol "PlayerInfo"
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(1031) : warning 215: expression has no effect
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(1031) : error 001: expected token: ";", but found "]"
C:\Users\Jole\Desktop\jobs\[BG]Cops`n`Robbers.pwn(1031) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


6 Errors.
Poslednja Izmena: Jul 03, 2010, 12:57:56 POSLE PODNE od [AdmTeam]_jovan

A da nam kazes koji GM koristis, ili to radis svoj FS?.. i nisam mislio doslovno samo 1 liniju nego nekoliko gore, nekoliko dole :S
Aequam memento rebus in arduis servare mentem.

Uspeo sam resiti problem sada ako moze LOCK!  :)
Poslednja Izmena: Jul 10, 2010, 10:33:22 PRE PODNE od [AdmTeam]_jovan