PAWN Crash - 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: PAWN Crash (
/showthread.php?tid=302714)
PAWN Crash -
zxc1 - 10.12.2011
pawn Код:
if(strcmp(cmd, "/startlottery", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
if(LotteryNumber == 0)
{
tmp = mystrtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_GREY,".: Usage: /startlottery [LotteryNumber] [Price] :.");
return 1;
}
new lotnumb,price;
lotnumb = strval(tmp);
tmp = mystrtok(cmdtext,idx);
price = strval(tmp);
if(lotnumb < 1 || lotnumb > 150)
{
SendClientMessage(playerid,COLOR_ERROR,".: Error: You must insert a lottery number between 1 - 150");
return 1;
}
if(price < 1 || price > 500000)
{
SendClientMessage(playerid,COLOR_ERROR,".: Error: You must insert a price between 1 - 500,000");
return 1;
}
LotteryNumber = lotnumb;
LotteryPrice = price;
LotterySpent = 0;
SendClientMessageToAll(COLOR_LOT1,"[Lottery] The Lottery has been {66CCCC}started.\n {6699CC}Use {66CCCC}/lot [number] {6699CC}to practicipate and get a chance to win !
}
else
{
SendClientMessage(playerid,COLOR_ERROR,".: Error: A Lottery is already started :.");
}
}
}
return 1;
}
Why is this command crashing my pawno?
Re: PAWN Crash -
Calgon - 10.12.2011
pawn Код:
SendClientMessageToAll(COLOR_LOT1,"[Lottery] The Lottery has been {66CCCC}started.\n {6699CC}Use {66CCCC}/lot [number] {6699CC}to practicipate and get a chance to win !
You need to end the client message statement.
Fixed code:
pawn Код:
SendClientMessageToAll(COLOR_LOT1,"[Lottery] The Lottery has been {66CCCC}started.\n {6699CC}Use {66CCCC}/lot [number] {6699CC}to practicipate and get a chance to win !");
Also, I'm not entirely sure you can use '/n' to start a new line in a client message, you might have to send a new client message.
Re: PAWN Crash -
Thresholdold - 10.12.2011
EDIT: Too slow
Re: PAWN Crash -
zxc1 - 10.12.2011
Thanks Calgon !
I didn't notice that I didn't end the statement.