SA-MP Forums Archive
COMMAND: /sex (+REP) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: COMMAND: /sex (+REP) (/showthread.php?tid=566598)



COMMAND: /sex (+REP) - SkilledMaster - 07.03.2015

Alright so I'm having a little trouble with my sex command in the script.

The following is the code of /sex.

PHP Code:
CMD:sex(playeridparams[])
{
    if(!
IsPlayerInAnyVehicle(playerid))
        {
            
SendClientMessageEx(playeridCOLOR_GREY"   You can only have Sex in a Car!");
            return 
1;
        }
        new 
Car GetPlayerVehicleID(playerid);
        new 
string[128], giveplayeridmoney;
        if(
sscanf(params"ud"giveplayeridmoney)) return SendClientMessageEx(playeridCOLOR_GREY"USAGE: /sex [player] [price]");
        if(
money || money 10000) { SendClientMessageEx(playeridCOLOR_GREY"   Price not lower then $1 or above $10,000!"); return 1; }
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
giveplayerid != INVALID_PLAYER_ID)
            {
                if (
ProxDetectorS(8.0playeridgiveplayerid))
                {
                    if(
giveplayerid == playerid) { SendClientMessageEx(playeridCOLOR_GREY"You cannot have Sex with yourself!"); return 1; }
                    if(
IsPlayerInAnyVehicle(playerid) && IsPlayerInVehicle(giveplayeridCar))
                    {
                        if(
gettime() >= PlayerInfo[playerid][pSexTime])
                        {
                            
format(stringsizeof(string), "* You offered %s to have sex with you, for $%s."GetPlayerNameEx(giveplayerid), number_format(money));
                            
SendClientMessageEx(playeridCOLOR_LIGHTBLUEstring);
                            
format(stringsizeof(string), "* Whore %s has offered you to have sex with them, for $%s (type /accept sex) to accept."GetPlayerNameEx(playerid), number_format(money));
                            
SendClientMessageEx(giveplayeridCOLOR_LIGHTBLUEstring);
                            
SexOffer[giveplayerid] = playerid;
                            
SexPrice[giveplayerid] = money;
                            
PlayerInfo[playerid][pSexTime] = gettime()+60;
                        }
                        else
                        {
                            
SendClientMessageEx(playeridCOLOR_GRAD2" You have already had sex, wait for your reload time to finish!");
                            return 
1;
                        }
                    }
                    else
                    {
                        
SendClientMessageEx(playeridCOLOR_GREY"   You or the other person must be in a Car together!");
                        return 
1;
                    }
                }
                else
                {
                    
SendClientMessageEx(playeridCOLOR_GREY"That person isn't near you.");
                    return 
1;
                }
            }
        }
        else
        {
            
SendClientMessageEx(playeridCOLOR_GREY"Invalid player specified.");
            return 
1;
        }
    }

and then this is what its showing me with errors and warning.

Code:
./includes/commands.pwn(44643) : warning 217: loose indentation
./includes/commands.pwn(44648) : warning 217: loose indentation
./includes/commands.pwn(48765) : warning 209: function "cmd_sex" should return a value
./includes/commands.pwn(48766) : error 010: invalid function or declaration



Re: COMMAND: /sex (+REP) - Ryan_Bowe - 07.03.2015

Please point out the lines that have the errors.


Re: COMMAND: /sex (+REP) - rickisme - 07.03.2015

pawn Code:
CMD:sex(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid))
    {
        SendClientMessageEx(playerid, COLOR_GREY, "   You can only have Sex in a Car!");
        return 1;
    }
    new Car = GetPlayerVehicleID(playerid);

    new string[128], giveplayerid, money;
    if(sscanf(params, "ud", giveplayerid, money)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /sex [player] [price]");

    if(money < 1 || money > 10000) { SendClientMessageEx(playerid, COLOR_GREY, "   Price not lower then $1 or above $10,000!"); return 1; }
    if(IsPlayerConnected(giveplayerid))
    {
        if(giveplayerid != INVALID_PLAYER_ID)
        {
            if (ProxDetectorS(8.0, playerid, giveplayerid))
            {
                if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot have Sex with yourself!"); return 1; }
                if(IsPlayerInAnyVehicle(playerid) && IsPlayerInVehicle(giveplayerid, Car))
                {
                    if(gettime() >= PlayerInfo[playerid][pSexTime])
                    {
                        format(string, sizeof(string), "* You offered %s to have sex with you, for $%s.", GetPlayerNameEx(giveplayerid), number_format(money));
                        SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* Whore %s has offered you to have sex with them, for $%s (type /accept sex) to accept.", GetPlayerNameEx(playerid), number_format(money));
                        SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
                        SexOffer[giveplayerid] = playerid;
                        SexPrice[giveplayerid] = money;
                        PlayerInfo[playerid][pSexTime] = gettime()+60;
                    }
                    else
                    {
                        SendClientMessageEx(playerid, COLOR_GRAD2, " You have already had sex, wait for your reload time to finish!");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessageEx(playerid, COLOR_GREY, "   You or the other person must be in a Car together!");
                    return 1;
                }
            }
            else
            {
                SendClientMessageEx(playerid, COLOR_GREY, "That person isn't near you.");
                return 1;
            }
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
        return 1;
    }
    return 1;
}



Re: COMMAND: /sex (+REP) - Finnick - 07.03.2015

Where's error line?


Re: COMMAND: /sex (+REP) - SkilledMaster - 07.03.2015

Quote:
Originally Posted by rickisme
View Post
pawn Code:
CMD:sex(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid))
    {
        SendClientMessageEx(playerid, COLOR_GREY, "   You can only have Sex in a Car!");
        return 1;
    }
    new Car = GetPlayerVehicleID(playerid);

    new string[128], giveplayerid, money;
    if(sscanf(params, "ud", giveplayerid, money)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /sex [player] [price]");

    if(money < 1 || money > 10000) { SendClientMessageEx(playerid, COLOR_GREY, "   Price not lower then $1 or above $10,000!"); return 1; }
    if(IsPlayerConnected(giveplayerid))
    {
        if(giveplayerid != INVALID_PLAYER_ID)
        {
            if (ProxDetectorS(8.0, playerid, giveplayerid))
            {
                if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot have Sex with yourself!"); return 1; }
                if(IsPlayerInAnyVehicle(playerid) && IsPlayerInVehicle(giveplayerid, Car))
                {
                    if(gettime() >= PlayerInfo[playerid][pSexTime])
                    {
                        format(string, sizeof(string), "* You offered %s to have sex with you, for $%s.", GetPlayerNameEx(giveplayerid), number_format(money));
                        SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* Whore %s has offered you to have sex with them, for $%s (type /accept sex) to accept.", GetPlayerNameEx(playerid), number_format(money));
                        SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
                        SexOffer[giveplayerid] = playerid;
                        SexPrice[giveplayerid] = money;
                        PlayerInfo[playerid][pSexTime] = gettime()+60;
                    }
                    else
                    {
                        SendClientMessageEx(playerid, COLOR_GRAD2, " You have already had sex, wait for your reload time to finish!");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessageEx(playerid, COLOR_GREY, "   You or the other person must be in a Car together!");
                    return 1;
                }
            }
            else
            {
                SendClientMessageEx(playerid, COLOR_GREY, "That person isn't near you.");
                return 1;
            }
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
        return 1;
    }
    return 1;
}
Thanks You have been give an reputation point for your work xD