SA-MP Forums Archive
Warnings - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Warnings (/showthread.php?tid=234387)



Warnings - yoan103 - 03.03.2011

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/nrg1", cmdtext, true, 10) == 0)
{
{
if(IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid), 2857.31,-1960.78,10.9376);
SetVehicleZAngle(GetPlayerVehicleID(playerid), 0.0);
LinkVehicleToInterior(GetPlayerVehicleID(playerid) , 0);
}
else
{
SetPlayerPos(playerid, 2857.31,-1960.78,10.9376);
SetPlayerFacingAngle(playerid, 0.0);
}
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, COLOR_LIGHTBLUE, " Welcome to Nrg1!");
return 1;
}
return 0;
}
}

and theese are the warnings

C:\Documents and Settings\maya\Desktop\Games\samp03csvr_win32\pawno \Untitled.pwn(95) : warning 225: unreachable code
C:\Documents and Settings\maya\Desktop\Games\samp03csvr_win32\pawno \Untitled.pwn(95) : warning 217: loose indentation
C:\Documents and Settings\maya\Desktop\Games\samp03csvr_win32\pawno \Untitled.pwn(97) : warning 209: function "OnPlayerCommandText" should return a value

line 95 is return 0;

line 97 is the last }


Respuesta: Warnings - Code8976Man - 03.03.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/nrg1", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SetVehiclePos(GetPlayerVehicleID(playerid), 2857.31,-1960.78,10.9376);
            SetVehicleZAngle(GetPlayerVehicleID(playerid), 0.0);
            LinkVehicleToInterior(GetPlayerVehicleID(playerid) , 0);
        }
        else
        {
            SetPlayerPos(playerid, 2857.31,-1960.78,10.9376);
            SetPlayerFacingAngle(playerid, 0.0);
        }
        SetPlayerInterior(playerid, 0);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, " Welcome to Nrg1!");
        return 1;
    }
    return 0;
}
Try this code.

Use [pawn ] [/pawn ] for code.


Re: Warnings - yoan103 - 03.03.2011

Thanks, i didn't know how to put it in a code