warning 217: loose indentation
#1

Код:
#include <a_samp>

#define filterscript
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//*****EDIT BELOW THIS LINE:*****
//------------------------------------------------------------------------------------------------------------------------------------------------------------
#define DISTANCE_BETWEEN_PLAYERS 5 //The minimum distance between players to be able to rob                     |
#define COLOR_ROB 0x00FFFFFF //The color of the text send to the players when made a successfull rob             |
#define COLOR_FAIL 0x00FFFFFF //Color of the text displayed to the players when a rob has failed                        |
#define COLOR_ERROR 0xFF0000FF //Color of the text when there is an error                                                                 |
#define ROB_TIME 7000 //Time between rob commands to prevent spam (in milliseconds)                                      |
//*****NO NEED TO EDIT BELOW THIS LINE:*****                                                                                                                       |
//------------------------------------------------------------------------------------------------------------------------------------------------------------

new robtime[MAX_PLAYERS];
new ID;


stock Float:GetDistanceBetweenPlayers(p1,p2){
        new Float:x1,Float:y1,Float:z1,Float:x3,Float:y3,Float:z3;
        if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2)){
                return -1.00;
        }
        GetPlayerPos(p1,x1,y1,z1);
        GetPlayerPos(p2,x3,y3,z3);
        return floatsqroot(floatpower(floatabs(floatsub(x3,x1)),2)+floatpower(floatabs(floatsub(y3,y1)),2)+floatpower(floatabs(floatsub(z3,z1)),2));
}

forward robtimer(id);

dcmd_rob(playerid, params[])
        {
                new pname[MAX_PLAYER_NAME];
                GetPlayerName(playerid, pname, sizeof(pname));
                if(!strlen(params))
                {
                        SendClientMessage(playerid, COLOR_ERROR, "Correct usage: /rob [ID]");
                }
                else
                {
                        ID = strval(params);
                        if(robtime[playerid] == 0)
                        {
                                if(ID != playerid)
                                {
                                        if(IsPlayerConnected(ID))
                                        {
                                                new oname[MAX_PLAYER_NAME];
                                                GetPlayerName(ID, oname, sizeof(oname));
                                                if(GetDistanceBetweenPlayers(playerid, ID) <= DISTANCE_BETWEEN_PLAYERS)
                                                {
                                                        if(!GetPlayerVehicleID(ID) || GetPlayerVehicleID(ID) == GetPlayerVehicleID(ID))
                                                        {
                                                                if(GetPlayerMoney(ID) > 0)
                                                                {
                                                                        new rob = random(11);
                                                                        if(rob == 1 || rob == 2 || rob == 10 || rob == 11)
                                                                        {
                                                                                new string[256];
                                                                                format(string, sizeof(string), "%s (%i) noticed you trying to rob him. Attempt failed!",oname, ID);
                                                                                SendClientMessage(playerid, COLOR_ROB, string);
                                                                                format(string, sizeof(string), "~w~%s Noticed you trying to rob him.~n~Attempt failed!.",oname, ID);
                                                                                GameTextForPlayer(playerid, string, 5000, 4);
                                                                                GetPlayerName(playerid,pname,sizeof(pname));
                                                                                format(string, sizeof(string), "You noticed %s (%i) trying to rob you. His attempt has failed!", pname, playerid);
                                                                                SendClientMessage(ID, COLOR_ROB, string);
                                                                                format(string, sizeof(string), "~w~You noticed %s trying to rob you.~n~His attempt has failed!", pname, playerid);
                                                                                GameTextForPlayer(ID, string, 5000, 4);
                                                                        }
                                                                        else if(rob == 3)
                                                                        {
                                                                                new pcash = GetPlayerMoney(ID);
                                                                                new robcash = random(pcash);
                                                                                GivePlayerMoney(ID, -robcash);
                                                                                GivePlayerMoney(playerid, robcash);
                                                                                GetPlayerName(playerid, pname, sizeof(pname));
                                                                                new string[256];
                                                                                format(string, sizeof(string), "You have robbed $%i from %s (%i).", robcash, oname, ID);
                                                                                SendClientMessage(playerid, COLOR_ROB, string);
                                                                                format(string, sizeof(string), "~w~Robbed $%i from %s.", robcash, oname);
                                                                                GameTextForPlayer(playerid, string, 5000, 4);
                                                                                format(string, sizeof(string), "%s (%i) has robbed $%i from you.", pname, playerid, robcash);
                                                                                SendClientMessage(ID, COLOR_ROB, string);
                                                                                format(string, sizeof(string), "~w~%s has robbed $%i from you.", pname, robcash);
                                                                                GameTextForPlayer(ID, string, 5000, 4);
                                                                        }
                                                                        else if(rob == 4 || rob == 5 || rob == 8)
                                                                        {
                                                                                new pcash = GetPlayerMoney(ID);
                                                                                new robcash = random(pcash);
                                                                                new robcash2 = robcash-random(robcash);
                                                                                GivePlayerMoney(ID, -robcash2);
                                                                                GivePlayerMoney(playerid, robcash2);
                                                                                new string[256];
                                                                                GetPlayerName(playerid, pname, sizeof(pname));
                                                                                format(string, sizeof(string), "You have robbed $%i from %s (%i).", robcash2, oname, ID);
                                                                                SendClientMessage(playerid, COLOR_ROB, string);
                                                                                format(string, sizeof(string), "~w~Robbed $%i from %s.", robcash2, oname);
                                                                                GameTextForPlayer(playerid, string, 5000, 4);
                                                                                format(string, sizeof(string), "%s (%i) has robbed $%i from you.", pname, playerid, robcash2);
                                                                                SendClientMessage(ID, COLOR_ROB, string);
                                                                                format(string, sizeof(string), "~w~%s has robbed $%i from you.", pname, robcash2);
                                                                                GameTextForPlayer(ID, string, 5000, 4);
                                                                        }
                                                                        else if(rob == 6 || rob == 7)
                                                                        {
                                                                                new pcash = GetPlayerMoney(ID);
                                                                                new robcash = random(pcash);
                                                                                new robcash2 = robcash-random(robcash);
                                                                                new robcash3 = robcash2-random(robcash2);
                                                                                GivePlayerMoney(ID, -robcash3);
                                                                                GivePlayerMoney(playerid, robcash3);
                                                                                new string[256];
                                                                                GetPlayerName(playerid, pname, sizeof(pname));
                                                                                format(string, sizeof(string), "You have robbed $%i from %s (%i).", robcash3, oname, ID);
                                                                                SendClientMessage(playerid, COLOR_ROB, string);
                                                                                format(string, sizeof(string), "%s (%i) has robbed $%i from you.", pname, playerid, robcash3);
                                                                                SendClientMessage(ID, COLOR_ROB, string);
                                                                                format(string, sizeof(string), "~w~Robbed $%i from %s.", robcash3, oname);
                                                                                GameTextForPlayer(playerid, string, 5000, 4);
                                                                                format(string, sizeof(string), "~w~%s has robbed $%i from you.", pname, robcash3);
                                                                                GameTextForPlayer(ID, string, 5000, 4);
                                                                        }
                                                                        else
                                                                        {
                                                                                SetPlayerHealth(playerid, -69);
                                                                                new string[256];
                                                                                GetPlayerName(playerid, pname, sizeof(pname));
                                                                                format(string, sizeof(string), "Your hand has stuck to %s (%i)'s pocket. ", oname, ID);
                                                                                SendClientMessage(playerid, COLOR_FAIL, string);
                                                                                SendClientMessage(playerid, COLOR_FAIL, "He noticed it and ripped your arms off.");
                                                                                format(string, sizeof(string), "%s (%i)'s hand has stuck to your pocket while trying to rob you.", pname, playerid);
                                                                                SendClientMessage(ID, COLOR_FAIL, string);
                                                                                SendClientMessage(ID, COLOR_FAIL, "You noticed it and ripped his arms off.");
                                                                                format(string, sizeof(string), "*** %s (%i) has bled to death.", pname, playerid);
                                                                                SendClientMessageToAll(0x880000FF, string);
                                                                                format(string, sizeof(string), "~w~%s has ripped your arms off.", oname, ID);
                                                                                GameTextForPlayer(playerid, string, 5000, 4);
                                                                                format(string, sizeof(string), "~w~Ripped %s's arms off.", oname, ID);
                                                                                GameTextForPlayer(ID, string, 5000, 4);
                                                                        }
                                                                        robtime[playerid] = 1;
                                                                        SetTimerEx("robtimer", ROB_TIME, false, "i", playerid);
                                                                }
                                                                else
                                                                {
                                                                        new string[256];
                                                                        format(string, sizeof(string), "%s (%i) has no money to rob!", oname, ID);
                                                                        SendClientMessage(playerid, COLOR_ERROR, string);
                                                                }
                                                        }
                                                        else
                                                        {
                                                                new string[256];
                                                                format(string, sizeof(string), "%s (%i) has to be in the same vehicle as you to be able to rob!", oname, ID);
                                                                SendClientMessage(playerid, COLOR_ERROR, string);
                                                        }
                                                }
                                                else
                                                {
                                                        new string[256];
                                                        format(string, sizeof(string), "%s (%i) is not close enough to rob.", oname, ID);
                                                        SendClientMessage(playerid, COLOR_ERROR, string);
                                                }
                                        }
                                        else
                                        {
                                                SendClientMessage(playerid, COLOR_ERROR, "That player is not connected!");
                                        }
                                }
                                else
                                {
                                        SendClientMessage(playerid, COLOR_ERROR, "You cannot rob yourself!");
                                }
                        }
                        else
                        {
                                SendClientMessage(playerid, COLOR_ERROR, "Please wait before robbing someone again.");
                        }
                }
        return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
        dcmd(rob, 3, cmdtext);
        return 0;
}
public robtimer(id)
{
        robtime[id] = 0;
}
one erorr

Код:
C:\Users\ta\Desktop\rob.pwn(181) : warning 217: loose indentation
Reply
#2

It's not an error, it is a warning. You should indent your code nicely.

pawn Код:
#include <a_samp>

#define filterscript
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//*****EDIT BELOW THIS LINE:*****
//------------------------------------------------------------------------------------------------------------------------------------------------------------
#define DISTANCE_BETWEEN_PLAYERS 5 //The minimum distance between players to be able to rob                     |
#define COLOR_ROB 0x00FFFFFF //The color of the text send to the players when made a successfull rob             |
#define COLOR_FAIL 0x00FFFFFF //Color of the text displayed to the players when a rob has failed                        |
#define COLOR_ERROR 0xFF0000FF //Color of the text when there is an error                                                                 |
#define ROB_TIME 7000 //Time between rob commands to prevent spam (in milliseconds)                                      |
//*****NO NEED TO EDIT BELOW THIS LINE:*****                                                                                                                       |
//------------------------------------------------------------------------------------------------------------------------------------------------------------

new robtime[MAX_PLAYERS];
new ID;


stock Float:GetDistanceBetweenPlayers(p1,p2)
{
    new Float:x1,Float:y1,Float:z1,Float:x3,Float:y3,Float:z3;
    if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2)) return -1.00;
    GetPlayerPos(p1,x1,y1,z1);
    GetPlayerPos(p2,x3,y3,z3);
    return floatsqroot(floatpower(floatabs(floatsub(x3,x1)),2)+floatpower(floatabs(floatsub(y3,y1)),2)+floatpower(floatabs(floatsub(z3,z1)),2));
}

forward robtimer(id);

dcmd_rob(playerid, params[])
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    if(!strlen(params))
    {
        SendClientMessage(playerid, COLOR_ERROR, "Correct usage: /rob [ID]");
    }
    else
    {
        ID = strval(params);
        if(robtime[playerid] == 0)
        {
            if(ID != playerid)
            {
                if(IsPlayerConnected(ID))
                {
                    new oname[MAX_PLAYER_NAME];
                    GetPlayerName(ID, oname, sizeof(oname));
                    if(GetDistanceBetweenPlayers(playerid, ID) <= DISTANCE_BETWEEN_PLAYERS)
                    {
                        if(!GetPlayerVehicleID(ID) || GetPlayerVehicleID(ID) == GetPlayerVehicleID(ID))
                        {
                            if(GetPlayerMoney(ID) > 0)
                            {
                                new rob = random(11);
                                if(rob == 1 || rob == 2 || rob == 10 || rob == 11)
                                {
                                    new string[256];
                                    format(string, sizeof(string), "%s (%i) noticed you trying to rob him. Attempt failed!",oname, ID);
                                    SendClientMessage(playerid, COLOR_ROB, string);
                                    format(string, sizeof(string), "~w~%s Noticed you trying to rob him.~n~Attempt failed!.",oname, ID);
                                    GameTextForPlayer(playerid, string, 5000, 4);
                                    GetPlayerName(playerid,pname,sizeof(pname));
                                    format(string, sizeof(string), "You noticed %s (%i) trying to rob you. His attempt has failed!", pname, playerid);
                                    SendClientMessage(ID, COLOR_ROB, string);
                                    format(string, sizeof(string), "~w~You noticed %s trying to rob you.~n~His attempt has failed!", pname, playerid);
                                    GameTextForPlayer(ID, string, 5000, 4);
                                }
                                else if(rob == 3)
                                {
                                    new pcash = GetPlayerMoney(ID);
                                    new robcash = random(pcash);
                                    GivePlayerMoney(ID, -robcash);
                                    GivePlayerMoney(playerid, robcash);
                                    GetPlayerName(playerid, pname, sizeof(pname));
                                    new string[256];
                                    format(string, sizeof(string), "You have robbed $%i from %s (%i).", robcash, oname, ID);
                                    SendClientMessage(playerid, COLOR_ROB, string);
                                    format(string, sizeof(string), "~w~Robbed $%i from %s.", robcash, oname);
                                    GameTextForPlayer(playerid, string, 5000, 4);
                                    format(string, sizeof(string), "%s (%i) has robbed $%i from you.", pname, playerid, robcash);
                                    SendClientMessage(ID, COLOR_ROB, string);
                                    format(string, sizeof(string), "~w~%s has robbed $%i from you.", pname, robcash);
                                    GameTextForPlayer(ID, string, 5000, 4);
                                }
                                else if(rob == 4 || rob == 5 || rob == 8)
                                {
                                    new pcash = GetPlayerMoney(ID);
                                    new robcash = random(pcash);
                                    new robcash2 = robcash-random(robcash);
                                    GivePlayerMoney(ID, -robcash2);
                                    GivePlayerMoney(playerid, robcash2);
                                    new string[256];
                                    GetPlayerName(playerid, pname, sizeof(pname));
                                    format(string, sizeof(string), "You have robbed $%i from %s (%i).", robcash2, oname, ID);
                                    SendClientMessage(playerid, COLOR_ROB, string);
                                    format(string, sizeof(string), "~w~Robbed $%i from %s.", robcash2, oname);
                                    GameTextForPlayer(playerid, string, 5000, 4);
                                    format(string, sizeof(string), "%s (%i) has robbed $%i from you.", pname, playerid, robcash2);
                                    SendClientMessage(ID, COLOR_ROB, string);
                                    format(string, sizeof(string), "~w~%s has robbed $%i from you.", pname, robcash2);
                                    GameTextForPlayer(ID, string, 5000, 4);
                                }
                                else if(rob == 6 || rob == 7)
                                {
                                    new pcash = GetPlayerMoney(ID);
                                    new robcash = random(pcash);
                                    new robcash2 = robcash-random(robcash);
                                    new robcash3 = robcash2-random(robcash2);
                                    GivePlayerMoney(ID, -robcash3);
                                    GivePlayerMoney(playerid, robcash3);
                                    new string[256];
                                    GetPlayerName(playerid, pname, sizeof(pname));
                                    format(string, sizeof(string), "You have robbed $%i from %s (%i).", robcash3, oname, ID);
                                    SendClientMessage(playerid, COLOR_ROB, string);
                                    format(string, sizeof(string), "%s (%i) has robbed $%i from you.", pname, playerid, robcash3);
                                    SendClientMessage(ID, COLOR_ROB, string);
                                    format(string, sizeof(string), "~w~Robbed $%i from %s.", robcash3, oname);
                                    GameTextForPlayer(playerid, string, 5000, 4);
                                    format(string, sizeof(string), "~w~%s has robbed $%i from you.", pname, robcash3);
                                    GameTextForPlayer(ID, string, 5000, 4);
                                }
                                else
                                {
                                    SetPlayerHealth(playerid, -69);
                                    new string[256];
                                    GetPlayerName(playerid, pname, sizeof(pname));
                                    format(string, sizeof(string), "Your hand has stuck to %s (%i)'s pocket. ", oname, ID);
                                    SendClientMessage(playerid, COLOR_FAIL, string);
                                    SendClientMessage(playerid, COLOR_FAIL, "He noticed it and ripped your arms off.");
                                    format(string, sizeof(string), "%s (%i)'s hand has stuck to your pocket while trying to rob you.", pname, playerid);
                                    SendClientMessage(ID, COLOR_FAIL, string);
                                    SendClientMessage(ID, COLOR_FAIL, "You noticed it and ripped his arms off.");
                                    format(string, sizeof(string), "*** %s (%i) has bled to death.", pname, playerid);
                                    SendClientMessageToAll(0x880000FF, string);
                                    format(string, sizeof(string), "~w~%s has ripped your arms off.", oname, ID);
                                    GameTextForPlayer(playerid, string, 5000, 4);
                                    format(string, sizeof(string), "~w~Ripped %s's arms off.", oname, ID);
                                    GameTextForPlayer(ID, string, 5000, 4);
                                }
                                robtime[playerid] = 1;
                                SetTimerEx("robtimer", ROB_TIME, false, "i", playerid);
                            }
                            else
                            {
                                new string[256];
                                format(string, sizeof(string), "%s (%i) has no money to rob!", oname, ID);
                                SendClientMessage(playerid, COLOR_ERROR, string);
                            }
                        }
                        else
                        {
                            new string[256];
                            format(string, sizeof(string), "%s (%i) has to be in the same vehicle as you to be able to rob!", oname, ID);
                            SendClientMessage(playerid, COLOR_ERROR, string);
                        }
                    }
                    else
                    {
                        new string[256];
                        format(string, sizeof(string), "%s (%i) is not close enough to rob.", oname, ID);
                        SendClientMessage(playerid, COLOR_ERROR, string);
                    }
                }
                else SendClientMessage(playerid, COLOR_ERROR, "That player is not connected!");
            }
            else SendClientMessage(playerid, COLOR_ERROR, "You cannot rob yourself!");
        }
        else SendClientMessage(playerid, COLOR_ERROR, "Please wait before robbing someone again.");
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(rob, 3, cmdtext);
    return 0;
}
public robtimer(id)
{
    robtime[id] = 0;
}
PS: You command can be optimized a bit though.
Reply
#3

Control + G and type 181 and show us this line, btw loose indentation won't effect your script its just like this for example
pawn Код:
format(string, sizeof(string), "~w~Robbed $%i from %s.", robcash3, oname);
  GameTextForPlayer(playerid, string, 5000, 4); //notice in this line have different indentation with space
and use [ pawn ] [ /pawn ]
EDIT : Sorry scroll up to Konstantinos
Reply
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
It's not an error, it is a warning. You should indent your code nicely.

pawn Код:
#include <a_samp>

#define filterscript
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//*****EDIT BELOW THIS LINE:*****
//------------------------------------------------------------------------------------------------------------------------------------------------------------
#define DISTANCE_BETWEEN_PLAYERS 5 //The minimum distance between players to be able to rob                     |
#define COLOR_ROB 0x00FFFFFF //The color of the text send to the players when made a successfull rob             |
#define COLOR_FAIL 0x00FFFFFF //Color of the text displayed to the players when a rob has failed                        |
#define COLOR_ERROR 0xFF0000FF //Color of the text when there is an error                                                                 |
#define ROB_TIME 7000 //Time between rob commands to prevent spam (in milliseconds)                                      |
//*****NO NEED TO EDIT BELOW THIS LINE:*****                                                                                                                       |
//------------------------------------------------------------------------------------------------------------------------------------------------------------

new robtime[MAX_PLAYERS];
new ID;


stock Float:GetDistanceBetweenPlayers(p1,p2)
{
    new Float:x1,Float:y1,Float:z1,Float:x3,Float:y3,Float:z3;
    if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2)) return -1.00;
    GetPlayerPos(p1,x1,y1,z1);
    GetPlayerPos(p2,x3,y3,z3);
    return floatsqroot(floatpower(floatabs(floatsub(x3,x1)),2)+floatpower(floatabs(floatsub(y3,y1)),2)+floatpower(floatabs(floatsub(z3,z1)),2));
}

forward robtimer(id);

dcmd_rob(playerid, params[])
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    if(!strlen(params))
    {
        SendClientMessage(playerid, COLOR_ERROR, "Correct usage: /rob [ID]");
    }
    else
    {
        ID = strval(params);
        if(robtime[playerid] == 0)
        {
            if(ID != playerid)
            {
                if(IsPlayerConnected(ID))
                {
                    new oname[MAX_PLAYER_NAME];
                    GetPlayerName(ID, oname, sizeof(oname));
                    if(GetDistanceBetweenPlayers(playerid, ID) <= DISTANCE_BETWEEN_PLAYERS)
                    {
                        if(!GetPlayerVehicleID(ID) || GetPlayerVehicleID(ID) == GetPlayerVehicleID(ID))
                        {
                            if(GetPlayerMoney(ID) > 0)
                            {
                                new rob = random(11);
                                if(rob == 1 || rob == 2 || rob == 10 || rob == 11)
                                {
                                    new string[256];
                                    format(string, sizeof(string), "%s (%i) noticed you trying to rob him. Attempt failed!",oname, ID);
                                    SendClientMessage(playerid, COLOR_ROB, string);
                                    format(string, sizeof(string), "~w~%s Noticed you trying to rob him.~n~Attempt failed!.",oname, ID);
                                    GameTextForPlayer(playerid, string, 5000, 4);
                                    GetPlayerName(playerid,pname,sizeof(pname));
                                    format(string, sizeof(string), "You noticed %s (%i) trying to rob you. His attempt has failed!", pname, playerid);
                                    SendClientMessage(ID, COLOR_ROB, string);
                                    format(string, sizeof(string), "~w~You noticed %s trying to rob you.~n~His attempt has failed!", pname, playerid);
                                    GameTextForPlayer(ID, string, 5000, 4);
                                }
                                else if(rob == 3)
                                {
                                    new pcash = GetPlayerMoney(ID);
                                    new robcash = random(pcash);
                                    GivePlayerMoney(ID, -robcash);
                                    GivePlayerMoney(playerid, robcash);
                                    GetPlayerName(playerid, pname, sizeof(pname));
                                    new string[256];
                                    format(string, sizeof(string), "You have robbed $%i from %s (%i).", robcash, oname, ID);
                                    SendClientMessage(playerid, COLOR_ROB, string);
                                    format(string, sizeof(string), "~w~Robbed $%i from %s.", robcash, oname);
                                    GameTextForPlayer(playerid, string, 5000, 4);
                                    format(string, sizeof(string), "%s (%i) has robbed $%i from you.", pname, playerid, robcash);
                                    SendClientMessage(ID, COLOR_ROB, string);
                                    format(string, sizeof(string), "~w~%s has robbed $%i from you.", pname, robcash);
                                    GameTextForPlayer(ID, string, 5000, 4);
                                }
                                else if(rob == 4 || rob == 5 || rob == 8)
                                {
                                    new pcash = GetPlayerMoney(ID);
                                    new robcash = random(pcash);
                                    new robcash2 = robcash-random(robcash);
                                    GivePlayerMoney(ID, -robcash2);
                                    GivePlayerMoney(playerid, robcash2);
                                    new string[256];
                                    GetPlayerName(playerid, pname, sizeof(pname));
                                    format(string, sizeof(string), "You have robbed $%i from %s (%i).", robcash2, oname, ID);
                                    SendClientMessage(playerid, COLOR_ROB, string);
                                    format(string, sizeof(string), "~w~Robbed $%i from %s.", robcash2, oname);
                                    GameTextForPlayer(playerid, string, 5000, 4);
                                    format(string, sizeof(string), "%s (%i) has robbed $%i from you.", pname, playerid, robcash2);
                                    SendClientMessage(ID, COLOR_ROB, string);
                                    format(string, sizeof(string), "~w~%s has robbed $%i from you.", pname, robcash2);
                                    GameTextForPlayer(ID, string, 5000, 4);
                                }
                                else if(rob == 6 || rob == 7)
                                {
                                    new pcash = GetPlayerMoney(ID);
                                    new robcash = random(pcash);
                                    new robcash2 = robcash-random(robcash);
                                    new robcash3 = robcash2-random(robcash2);
                                    GivePlayerMoney(ID, -robcash3);
                                    GivePlayerMoney(playerid, robcash3);
                                    new string[256];
                                    GetPlayerName(playerid, pname, sizeof(pname));
                                    format(string, sizeof(string), "You have robbed $%i from %s (%i).", robcash3, oname, ID);
                                    SendClientMessage(playerid, COLOR_ROB, string);
                                    format(string, sizeof(string), "%s (%i) has robbed $%i from you.", pname, playerid, robcash3);
                                    SendClientMessage(ID, COLOR_ROB, string);
                                    format(string, sizeof(string), "~w~Robbed $%i from %s.", robcash3, oname);
                                    GameTextForPlayer(playerid, string, 5000, 4);
                                    format(string, sizeof(string), "~w~%s has robbed $%i from you.", pname, robcash3);
                                    GameTextForPlayer(ID, string, 5000, 4);
                                }
                                else
                                {
                                    SetPlayerHealth(playerid, -69);
                                    new string[256];
                                    GetPlayerName(playerid, pname, sizeof(pname));
                                    format(string, sizeof(string), "Your hand has stuck to %s (%i)'s pocket. ", oname, ID);
                                    SendClientMessage(playerid, COLOR_FAIL, string);
                                    SendClientMessage(playerid, COLOR_FAIL, "He noticed it and ripped your arms off.");
                                    format(string, sizeof(string), "%s (%i)'s hand has stuck to your pocket while trying to rob you.", pname, playerid);
                                    SendClientMessage(ID, COLOR_FAIL, string);
                                    SendClientMessage(ID, COLOR_FAIL, "You noticed it and ripped his arms off.");
                                    format(string, sizeof(string), "*** %s (%i) has bled to death.", pname, playerid);
                                    SendClientMessageToAll(0x880000FF, string);
                                    format(string, sizeof(string), "~w~%s has ripped your arms off.", oname, ID);
                                    GameTextForPlayer(playerid, string, 5000, 4);
                                    format(string, sizeof(string), "~w~Ripped %s's arms off.", oname, ID);
                                    GameTextForPlayer(ID, string, 5000, 4);
                                }
                                robtime[playerid] = 1;
                                SetTimerEx("robtimer", ROB_TIME, false, "i", playerid);
                            }
                            else
                            {
                                new string[256];
                                format(string, sizeof(string), "%s (%i) has no money to rob!", oname, ID);
                                SendClientMessage(playerid, COLOR_ERROR, string);
                            }
                        }
                        else
                        {
                            new string[256];
                            format(string, sizeof(string), "%s (%i) has to be in the same vehicle as you to be able to rob!", oname, ID);
                            SendClientMessage(playerid, COLOR_ERROR, string);
                        }
                    }
                    else
                    {
                        new string[256];
                        format(string, sizeof(string), "%s (%i) is not close enough to rob.", oname, ID);
                        SendClientMessage(playerid, COLOR_ERROR, string);
                    }
                }
                else SendClientMessage(playerid, COLOR_ERROR, "That player is not connected!");
            }
            else SendClientMessage(playerid, COLOR_ERROR, "You cannot rob yourself!");
        }
        else SendClientMessage(playerid, COLOR_ERROR, "Please wait before robbing someone again.");
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(rob, 3, cmdtext);
    return 0;
}
public robtimer(id)
{
    robtime[id] = 0;
}
PS: You command can be optimized a bit though.
is working thank u so much
Reply
#5

Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
Control + G and type 181 and show us this line, btw loose indentation won't effect your script its just like this for example
pawn Код:
format(string, sizeof(string), "~w~Robbed $%i from %s.", robcash3, oname);
  GameTextForPlayer(playerid, string, 5000, 4); //notice in this line have different indentation with space
and use [ pawn ] [ /pawn ]
EDIT : Sorry scroll up to Konstantinos
thank u so much SilentSoul for support
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)