Pawno Crash - Help!
#1

Hi All!

When i try to compile my gamemode, pawno is crashes. I found out, something wrong with dcmd_sex command.
Code:
pawn Код:
dcmd_sex(playerid, params[]);
{
if(IsSpawned[playerid] == 0)
{
SendClientMessage(playerid,RED,"You're Not Spawned. You Can't Use This Command.");
return 1;
}
if(!Player[playerid][InSexMission] == true)
{
SendClientMessage(playerid,RED,"You're Not In Prostitue Mission. You Cannot Use This Command Now.");
return 1;
}
if(!Player[playerid][OfferedSexToPlayer] == false)
{
SendClientMessage(playerid,RED,"Please Wait Before Offering Sex Again.");
return 1;
}
if(!strlen(params))
{
new ID2 = GetClosestPlayer(playerid);
if (GetDistanceBetweenPlayers(playerid, ID2) > 5.00) {
SendClientMessage(playerid,RED,"Nobody Close Enough To Sex With.");
return 1;
}
if(IsPlayerConnected(ID2))
goto sex;
else return SendClientMessage(playerid, RED, "USAGE: /sex [PartOfName/ID]");
}
new ID = IDFromName(params);
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "That Player Is Not Connected!");
if(ID == playerid) return SendClientMessage(playerid, COLOR_RED, "You Cannot Have Sex With Yourself!");
if (GetDistanceBetweenPlayers(playerid, ID) > 5.00) {
new string1[128];
format(string1,128,"%s (%i) Is Not Close Enough.", RPN(ID), ID);
SendClientMessage(playerid,RED,string1);
return 1;
}
sex:
if(!Player[ID][OfferedSex] == false)
{
new string[256];
format(string,256,"Someone Has Already Offered Sexual Service To %s (%i). Please Wait.",RPN(ID),ID);
SendClientMessage(playerid,RED,string);
return 1;
}
if(GetPlayerCash(ID) < 1000)
{
new string[256];
format(string,256,"%s (%i) Doesn't Has $1000 To Pay Your Sexual Offer.",RPN(ID),ID);
SendClientMessage(playerid,RED,string);
return 1;
}
new string[256];
format(string,256,"~w~offered ~y~sex ~w~to ~p~%s",RPN(ID));
GameTextForPlayer(playerid,string,4000,3);
format(string,256,"You Have Offered Sex To %s (%i). Please Wait While The Player Accepts Or Refuses.",RPN(ID), ID);
SendClientMessage(playerid,BLUE,string);
GetPlayerName(playerid, playerName, sizeof(playerName));
format(string,256,"~p~%s ~w~offered you ~y~sex ~w~for ~g~$1000~n~~w~type ~y~/accept ~w~or ~y~/refuse",playerName);
GameTextForPlayer(ID,string,4000,3);
format(string,256,"%s (%i) Has Offered You Sex For $1000. Type /accept To Accept Or /refuse To Refuse.",playerName,playerid);
SendClientMessage(ID,BLUE,string);
Player[playerid][OfferedSexToPlayer] = true;
Player[ID][OfferedSex] = true;
SetTimerEx("OfferedSexRecently", 30000, false, "i", playerid);
SetTimerEx("OfferCancel", 30000, false, "i", ID);
new prostitue = playerid;
return 1;
}
Please help me!
Reply
#2

Your PAWN Compiler is probably crashing because of this thingy:

pawn Код:
sex:
if(!Player[ID][OfferedSex] == false)
You can't use if(something) after something like Float:
Reply
#3

Use this

pawn Код:
dcmd_sex(playerid, params[])
not

pawn Код:
dcmd_sex(playerid, params[]);
Reply
#4

Quote:
Originally Posted by еddy
Your PAWN Compiler is probably crashing because of this thingy:

pawn Код:
sex:
if(!Player[ID][OfferedSex] == false)
You can't use if(something) after something like Float:
he uses "sex:" as a pointer for
Код:
goto sex;
Reply
#5

Quote:
Originally Posted by Blacklite
Use this

pawn Код:
dcmd_sex(playerid, params[])
not

pawn Код:
dcmd_sex(playerid, params[]);
Ohh thanks. Stupid mistake . I was sleepy.
Now i have another question. As you can see i wrote this: prostitue = playerid; but when i use it in another command, it says "undefined symbol: prostitue...
How can i solve it? Thanks for help. :P
Reply
#6

add new prostitute = playerid;
at the top if your script
Reply
#7

Quote:
Originally Posted by Augustinas
add new prostitute = playerid;
at the top if your script
No, i dont think it will be good.
Because, i use this code in other commands.
Here:

pawn Код:
dcmd_accept(playerid, params[])
{
if(!Player[playerid][OfferedSex] == true)
{
SendClientMessage(playerid,RED,"No One Has Offered You Sexual Service.");
return 1;
}
if(GetPlayerCash(playerid) < 1000)
{
SendClientMessage(playerid,RED,"You Don't Have $1000 To Accept The Offer.");
return 1;
}
new string[256];
new ID = IDFromName(params);
GivePlayerCash(playerid,-1000);
format(string,256,"~w~you had ~y~sex ~w~with~n~~p~%s~n~~w~for ~g~$1000",RPN(prostitue));
GameTextForPlayer(playerid,string,4000,3);
format(string,256,"You Had A Great Sex With %s (%i) For $1000.",RPN(prostitue),ID);
SendClientMessage(playerid,BLUE,string);
Player[playerid][OfferedSex] = false;
KillTimer(OfferCancel);
if(GetPlayerHealth(playerid) < 85)
{
new Float:Health;
GetPlayerHealth(playerid,Health);
SetPlayerHealth(playerid,Health+15);
}
new kuncsaft = playerid;
GivePlayerCash(prostitue,5000);
format(string,256,"%s (%i) Has Accepted Your Offer. You Had A Great Sex With %s. Received $5000 Prostitue Bonus.",RPN(kuncsaft), ID);
SendClientMessage(prostitue,BLUE,string);
format(string,256,"~p~%s ~w~accepted your offer~n~received ~g~$5000 ~y~prostitue bonus",RPN(kuncsaft));
GameTextForPlayer(prostitue,string,4000,3);
oscore = GetPlayerScore(prostitue);
SetPlayerScore(prostitue, oscore +1);
return 1;
}
Reply
#8

At the top of your script (Use -1 because that is an invalid player id):

pawn Код:
new prostitue = -1;
At the bottom your command:

pawn Код:
prostitue = playerid;
I'm just guessing, because I don't really know the use of the prostitute variable.

P.S: It's spelt prostitute, not prostitue
Reply
#9

Quote:
Originally Posted by Blacklite
At the top of your script (Use -1 because that is an invalid player id):

pawn Код:
new prostitue = -1;
At the bottom your command:

pawn Код:
prostitue = playerid;
I'm just guessing, because I don't really know the use of the prostitute variable.

P.S: It's spelt prostitute, not prostitue
OKay, thanks. Now i don't get errors. I should test it. PM sent with IP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)