SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 07/03/2015, 04:09 AM   #1
SkilledMaster
Little Clucker
 
Join Date: Jan 2014
Posts: 46
Reputation: 5
Default COMMAND: /sex (+REP)

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
__________________
REP IF YOU THINK MY POST ARE HELPFUL OR JUST GOOD ENOUGH TO GET REPUTATION
SkilledMaster is offline   Reply With Quote
Old 07/03/2015, 04:13 AM   #2
Ryan_Bowe
Huge Clucker
 
Join Date: Jul 2012
Location: United States
Posts: 218
Reputation: 16
Default Re: COMMAND: /sex (+REP)

Please point out the lines that have the errors.
Ryan_Bowe is offline   Reply With Quote
Old 07/03/2015, 04:14 AM   #3
rickisme
Huge Clucker
 
rickisme's Avatar
 
Join Date: Mar 2013
Location: Vietnam
Posts: 225
Reputation: 27
Default Re: COMMAND: /sex (+REP)

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;
}
__________________

Sorry for my bad english.
  1. [FS] SoundCloud Music Player
  2. [VIDEO] Horse Betting System
rickisme is offline   Reply With Quote
Old 07/03/2015, 04:16 AM   #4
Finnick
Banned
 
Join Date: Feb 2015
Location: Yeah
Posts: 40
Reputation: 12
Default Re: COMMAND: /sex (+REP)

Where's error line?
Finnick is offline   Reply With Quote
Old 07/03/2015, 04:17 AM   #5
SkilledMaster
Little Clucker
 
Join Date: Jan 2014
Posts: 46
Reputation: 5
Default Re: COMMAND: /sex (+REP)

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
__________________
REP IF YOU THINK MY POST ARE HELPFUL OR JUST GOOD ENOUGH TO GET REPUTATION
SkilledMaster is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] mcmd Command Engine - Plugin based command processing Mellnik Plugin Development 108 08/05/2016 01:55 PM
How can i save position from one command and put it in another command with out making new file RockyGamer Scripting Help 2 16/10/2014 10:57 AM
i had this command in my gamemode, when i type this in game,it tells server unknow command? Chrisli520 Scripting Help 3 24/11/2013 10:02 AM
Executed ZCMD command returns SERVER: Unknown Command SexTourist Scripting Help 12 03/01/2012 03:38 PM
Slap command returns an Unknown Command when player is not connected HydraX Help Archive 16 01/08/2011 05:19 AM


All times are GMT. The time now is 07:08 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.