Pawno crashes pls tell me the error
#1

hi,
can someone pls tell me the error?
Are that too many colours?
Cause without this colours it just compiles fine.
Now its just crashing.

pawn Код:
if (strcmp("/cmd", cmdtext, true) == 0)
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "{800000}Commands {855E42}(type in:)", "{855E42}/rules {A68064}to view the server rules\n{855E42}/info {A68064}to read a introduction how to play\n{855E42}/about {A68064}to view the server information\n{855E42}/stats {A68064}to view your game statistic\n\
{855E42}/kill {A68064}to kill yourself\n{855E42}/classselect {A68064}to return to the class selection\n{855E42}/mapi {A68064}to view the current maps information\n{855E42}/anim {A68064}to view the available animation commands\n{855E42}/q {A68064}to quit the game"
, "Ok", "Close");

return 1;
}
Reply
#2

No, but its to long :P Use strcat:

here i'll do it for you:

Код:
new Cmds[1024] =  "{800000}Commands {855E42}(type in:), {855E42}/rules {A68064}to view the server rules\n{855E42}/info {A68064}to read a introduction how to play\n";
strcat(Cmds, "{855E42}/about {A68064}to view the server information\n{855E42}}/stats {A68064}to view your game statistic\n\");
strcat(Cmds, "855E42}/kill {A68064}to kill yourself\n{855E42}/classselect {A68064}to return to the class selection\n");
strcat(Cmds, "{855E42}/mapi {A68064}to view the current maps information \n{855E42}/anim {A68064}to view the available animation commands\n");
strcat(Cmds, "{855E42}/q {A68064}to quit the game");
//^Put this under OnPlayerCommandText

if (strcmp("/cmd", cmdtext, true) == 0)
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX,"Commands",Cmds, "Ok, "Close");
return 1;
}
Also, it was a to long string. Thats why it crashed.
Reply
#3

hi,
thank you
But 1 error:

pawn Код:
error 021: symbol already defined: "strcat"

new Cmds[1024] = "{800000}Commands {855E42}(type in:), {855E42}/rules {A68064}to view the server rules\n{855E42}/info {A68064}to read a introduction how to play\n";
/*here*/strcat(Cmds, "{855E42}/about {A68064}to view the server information\n{855E42}}/stats {A68064}to view your game statistic\n\");
strcat(Cmds, "
{855E42}/kill {A68064}to kill yourself\n{855E42}/classselect {A68064}to return to the class selection\n");
strcat(Cmds, "
{855E42}/mapi {A68064}to view the current maps information \n{855E42}/anim {A68064}to view the available animation commands\n");
strcat(Cmds, "
{855E42}/q {A68064}to quit the game");
ive got a stock function in my script, so how can i solve this issue?
Reply
#4

get rid of the '\' at the end of the strcat
Reply
#5

thx SilentHuntR but it didnt solve the problem.
Any suggestions?
Reply
#6

can someone tell me why this is crashing now?

pawn Код:
if (strcmp("/anim", cmdtext, true) == 0)
{
//OnPlayerCommandText
new Anims[1024] = "{A9C9A4}/wank {A68064}to have some fun\n{A9C9A4}/tai {A68064}to do some taichi\n";
strcat(Anims, "{A9C9A4}/dance1 {A68064}to dance\n{A9C9A4}/dance2 {A68064}to strip\n");
strcat(Anims, "{A9C9A4}/handsup {A68064}to surrender\n{A9C9A4}/smoke {A68064}to smoke a cigaret\n");
strcat(Anims, "{A9C9A4}/wave1 {A68064}to wave\n{A9C9A4}/wave2 {A68064}to wave (a bit gay for men)\n");
strcat(Anims, "{A9C9A4}/point {A68064}to point at someone\n{A9C9A4}/relax {A68064}to relax\n{A9C9A4}/threat {A68064}to point a weapon a someone's head");

ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "{800000}Animations {855E42}(type in:)",Anims, "Ok", "Close");

return 1;
}

//cause this is the code above and this one is working

if (strcmp("/cmd", cmdtext, true) == 0)
{

new Cmds[1024] = "{A9C9A4}/rules {A68064}to view the server rules\n{A9C9A4}/info {A68064}to read a introduction how to play\n";
strcat(Cmds, "{A9C9A4}/about {A68064}to view the server information\n{A9C9A4}/stats {A68064}to view your game statistic\n");
strcat(Cmds, "{A9C9A4}/kill {A68064}to kill yourself\n{A9C9A4}/classselect {A68064}to return to the class selection\n");
strcat(Cmds, "{A9C9A4}/mapi {A68064}to view the current maps information \n{A9C9A4}/anim {A68064}to view the available animation commands\n");
strcat(Cmds, "{A9C9A4}/inv {A68064}to view your inventory\n{A9C9A4}/drug {A68064}to take an ecstasy pill\n{A9C9A4}/q {A68064}to quit the game");

ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX,"{800000}Commands {855E42}(type in:)",Cmds, "Ok", "Close");

return 1;
}
Reply
#7

Sorry, i found the error.
ty
Reply
#8

It's best if you move that under OnGameModeInit.
pawn Код:
new Cmds[560];

public OnGameModeInit()
{
    strcat(Cmds, "{A9C9A4}/rules {A68064}to view the server rules\n{A9C9A4}/info {A68064}to read a introduction how to play\n");
    strcat(Cmds, "{A9C9A4}/about {A68064}to view the server information\n{A9C9A4}/stats {A68064}to view your game statistic\n");
    strcat(Cmds, "{A9C9A4}/kill {A68064}to kill yourself\n{A9C9A4}/classselect {A68064}to return to the class selection\n");
    strcat(Cmds, "{A9C9A4}/mapi {A68064}to view the current maps information \n{A9C9A4}/anim {A68064}to view the available animation commands\n");
    strcat(Cmds, "{A9C9A4}/inv {A68064}to view your inventory\n{A9C9A4}/drug {A68064}to take an ecstasy pill\n{A9C9A4}/q {A68064}to quit the game");

    printf("%d", strlen(Cmds)); //outputs 559

    return 1;
}
I'm just saying.
Reply
#9

thx for the advice

does it use/waste a lot of rescources if its also under OnPlayerCommandText?
Reply
#10

pawn Код:
format(Stats, sizeof(Stats), "Player: {800000}%d\nKills: %d\nDeaths: %d\nRatio: %0.2f\nRank: %d\nRank Number: %d\n",GetPlayerName(playerid),kills[playerid],deaths[playerid],ratio,RankName[pRank[playerid]],pRank[playerid]);
format(Stats, sizeof(Stats), "%s Score: %d\nMoney: %d$\nBombs smuggeled: %d\nCountdown started: %d\nBombs disabled: %d\n",Stats,GetPlayerScore(playerid),GetPlayerMoney(playerid),bombsmuggelcounter[playerid],countdownstartcounter[playerid],bombdisablecounter[playerid]);
format(Stats, sizeof(Stats), "%s Started the moneyrush: %d\nFound the moneyrush moneybag: %d\n",Stats,moneyrushstartcount[playerid],foundmoneybag[playerid]);
format(Stats, sizeof(Stats), "%s Random weapons received: %d\nAttended Sudden Death Modes: %d\n",Stats,randomwepgot[playerid],suddendeathmode[playerid]);
format(Stats, sizeof(Stats), "%s Rounds played: %d\nThereof moneyrush: %d",Stats,RoundsPlayedCouter[playerid],playedmoneyrush[playerid]);
format(Stats, sizeof(Stats), "%s Time played on this server: %d hours and %d minutes",Stats,Hours[playerid],Minutes[playerid]);
format(Stats, sizeof(Stats), "%s Admin status (rank): %d",Stats, Spieler[playerid][AdminLevel]);
that would do the job.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)