How would I make this work?
#1

pawn Код:
if(!strcmp(params, "health", true))
    {
        if(params == "health" && SDay == "health") return SendClientMessage(playerid, COLOR_GREY, "The day is already on day of good health.");
I get this error. hrp.pwn(16559) : error 001: expected token: "-string end-", but found "-identifier-"
Reply
#2

pawn Код:
if(params == "health" && SDay == "health) return SendClientMessage(playerid, COLOR_GREY, "The day is already on day of good health.");
should be

pawn Код:
if(!strcmp(params, "health", true) || !strcmp(params, "SDay", true)) return SendClientMessage(playerid, COLOR_GREY, "The day is already on day of good health.");
You can't use string as integer.

So you have to use string comparer (strcmp).
Reply
#3

pawn Код:
if(!strcmp(params, "health", true))
    {
        if(!strcmp(params, "health", true) || !strcmp(params, "SDay", true)) return SendClientMessage(playerid, COLOR_GREY, "The day is already on day of good health.");
        timerhealthd = SetTimer("HealthDTimer", 1000, true);
        SendClientMessageToAll(COLOR_LIGHTBLUE, "Calendar: Today is the day of {33AA33}good health{33CCFF} your doctor has flagged you as very healthy.");
        SendClientMessageToAll(COLOR_LIGHTBLUE, "Roleplay Explanation: You will recieve 1 health point for each second played on the server, for the length of the day.");
        SDay = "health";
        return 1;
    }
    if(!strcmp(params, "normal", true))
    {
        if(!strcmp(params, "normal", true) || !strcmp(params, "SDay", true)) return SendClientMessage(playerid, COLOR_GREY, "The day is already normal.");
        KillTimer(timerhealthd);
        SendClientMessageToAll(COLOR_LIGHTBLUE, "Calendar: Today is just a regular day.");
        SDay = "normal";
        return 1;
    }
Doesn't work properly.
Reply
#4

What happens if you test it?
Reply
#5

hi grant

Try this:

pawn Код:
if(!strcmp(params, "health", true))
    {
        if(strcmp(params, "health", true) == 0 || strcmp(params, SDay, true) == 0) return SendClientMessage(playerid, COLOR_GREY, "The day is already on day of good health.");
        timerhealthd = SetTimer("HealthDTimer", 1000, true);
        SendClientMessageToAll(COLOR_LIGHTBLUE, "Calendar: Today is the day of {33AA33}good health{33CCFF} your doctor has flagged you as very healthy.");
        SendClientMessageToAll(COLOR_LIGHTBLUE, "Roleplay Explanation: You will recieve 1 health point for each second played on the server, for the length of the day.");
        SDay = "health";
        return 1;
    }
    if(!strcmp(params, "normal", true))
    {
        if(strcmp(params, "health", true) == 0 || strcmp(params, SDay, true) == 0) return SendClientMessage(playerid, COLOR_GREY, "The day is already normal.");
        KillTimer(timerhealthd);
        SendClientMessageToAll(COLOR_LIGHTBLUE, "Calendar: Today is just a regular day.");
        SDay = "normal";
        return 1;
    }
Reply
#6

Fanks Emmet!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)