SA-MP Forums Archive
How would I make this work? - 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: How would I make this work? (/showthread.php?tid=384958)



How would I make this work? - grantism - 13.10.2012

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-"


Re: How would I make this work? - JaKe Elite - 14.10.2012

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


Re: How would I make this work? - grantism - 14.10.2012

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.


Re: How would I make this work? - JaKe Elite - 14.10.2012

What happens if you test it?


Re: How would I make this work? - Emmet_ - 14.10.2012

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



Re: How would I make this work? - grantism - 14.10.2012

Fanks Emmet!