SA-MP Forums Archive
stock warning - 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: stock warning (/showthread.php?tid=473565)



stock warning - LeeXian99 - 03.11.2013

Weird, just made this!

pawn Код:
stock KickWhenNotRegister(playerid)
{
    SendClientMessage(playerid, -1, "{ff0000}=KICKED=: {ffffff}To play here, you must register an account here! Sorry!");
    SetTimerEx("KickWithMsg", 1000, 0, "d", playerid);
}

stock KickWhenNotLoggedIn(playerid)
{
    SendClientMessage(playerid, -1, "{ff0000}=KICKED=: {ffffff}To continue your session, it's necesscary to login to your account! Sorry!");
    SetTimerEx("KickWithMsg", 1000, 0, "d", playerid);
}
The use of these thing is at
pawn Код:
if(!response) return KickWhenNotRegister(playerid);
if(!response) return KickWhenNotLoggedIn(playerid);
Errors:
Код:
B:\NewProject\gamemodes\CnR.pwn(418) : warning 209: function "KickWhenNotRegister" should return a value
B:\NewProject\gamemodes\CnR.pwn(448) : warning 209: function "KickWhenNotLoggedIn" should return a value
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Any ideas to fix this? (Need to do this gamemode fast, this problem got my stuck for some minutes, still can't figure it out what's wrong. Checked this errors for thrice...


Re: stock warning - DanishHaq - 03.11.2013

pawn Код:
stock KickWhenNotRegister(playerid)
{
    SendClientMessage(playerid, -1, "{ff0000}=KICKED=: {ffffff}To play here, you must register an account here! Sorry!");
    SetTimerEx("KickWithMsg", 1000, 0, "d", playerid);
    return 1;
}

stock KickWhenNotLoggedIn(playerid)
{
    SendClientMessage(playerid, -1, "{ff0000}=KICKED=: {ffffff}To continue your session, it's necesscary to login to your account! Sorry!");
    SetTimerEx("KickWithMsg", 1000, 0, "d", playerid);
    return 1;
}
If it must return a value, then you need to return a value... it's not that hard to understand.


Re: stock warning - Konstantinos - 03.11.2013

You can either use:
pawn Код:
if(!response)
{
    KickWhenNotRegister(playerid);
    return 1;
}
pawn Код:
if(!response)
{
    KickWhenNotLoggedIn(playerid);
    return 1;
}
since it does not return any value or:
pawn Код:
stock KickWhenNotRegister(playerid)
{
    SendClientMessage(playerid, -1, "{ff0000}=KICKED=: {ffffff}To play here, you must register an account here! Sorry!");
    SetTimerEx("KickWithMsg", 1000, 0, "d", playerid);
    return 1;
}

stock KickWhenNotLoggedIn(playerid)
{
    SendClientMessage(playerid, -1, "{ff0000}=KICKED=: {ffffff}To continue your session, it's necesscary to login to your account! Sorry!");
    SetTimerEx("KickWithMsg", 1000, 0, "d", playerid);
    return 1;
}
with:
pawn Код:
if(!response) return KickWhenNotRegister(playerid);
if(!response) return KickWhenNotLoggedIn(playerid);



Re: stock warning - LeeXian99 - 03.11.2013

Oops, my bad, seems I'm sleepy and needs to get a coffee tonight, thanks for helping! +repped both and will see these things as a lesson.