PDA

View Full Version : COMMAND: /sex (+REP)


SkilledMaster
07/03/2015, 04:09 AM
Alright so I'm having a little trouble with my sex command in the script.

The following is the code of /sex.

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

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


./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

Ryan_Bowe
07/03/2015, 04:13 AM
Please point out the lines that have the errors.

rickisme
07/03/2015, 04:14 AM
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;
}

Finnick
07/03/2015, 04:16 AM
Where's error line?

SkilledMaster
07/03/2015, 04:17 AM
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