2 teleport commands in one gamemode not working - 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: 2 teleport commands in one gamemode not working (
/showthread.php?tid=582851)
2 teleport commands in one gamemode not working -
Markhoss - 23.07.2015
Hi everyone when I write this code in pawn
http://i.imgur.com/ryf2pMy.png
It gives me 1 warning which says this
http://i.imgur.com/wjJoAww.png
Can anyone please tell me how can I delete this warning and what do I need to change in the code?
Here is the code for you to copy and paste
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/sky", cmdtext, true,
)
{
SetPlayerPos(playerid, 4132.2002,-1846.2002,2.5);
SetPlayerInterior(playerid, 0);
return 1;
}
return 0;
if(!strcmp("/markhoss", cmdtext, true,
)
{
SetPlayerPos(playerid, 1435.4,1208.9,643);
SetPlayerInterior(playerid, 0);
return 1;
}
return 0;
}
(I am sorry about the smilies in the code that's why I used the pictures instead)
AW: 2 teleport commands in one gamemode not working -
Nero_3D - 23.07.2015
Well the warnings already tells you that the code at line 1296 is unreachable
The reason for that is always a wrong placed return
=> Remove the first return 0; statment
Re: 2 teleport commands in one gamemode not working -
Markhoss - 23.07.2015
Thank you so much it worked I never understood returns now I hopefully will