[Help] expression has no effect - Warning. -
Miikkel - 06.07.2010
I have this little code for my Roleplay Gamemode.
But it comes up with warnings saying:
Quote:
C:\Users\Mikkel\Desktop\SA-MP Server\gamemodes\TeRP.pwn(457) : warning 215: expression has no effect
C:\Users\Mikkel\Desktop\SA-MP Server\gamemodes\TeRP.pwn(462) : warning 215: expression has no effect
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Warnings.
|
Code:
pawn Код:
if(dialogid == 2) //Sex Dialog Box
{
if(response)
{
if(listitem == 0)
{
pInfo[playerid][pSex] == 1; //Male - Line 457
SetPlayerSkin(playerid, 299);
}
else if(listitem == 1)
{
pInfo[playerid][pSex] == 2; //Female - Line 462
SetPlayerSkin(playerid, 298);
}
}
}
return 1;
I want it to store the Sex ID in the pSex.
Re: [Help] expression has no effect - Warning. -
Matthias_ - 06.07.2010
pawn Код:
pInfo[playerid][pSex] == 1;
pInfo[playerid][pSex] == 2;
== means "is equal to". It's used in statements like these:
pawn Код:
if(pInfo[playerid][pSex] == 2)
{
doSomething();
}
You're supposed to use:
pawn Код:
pInfo[playerid][pSex] = 1;
pInfo[playerid][pSex] = 2;
That way pInfo[playerid][pSex] is assigned to either 1 or 2.
Re: [Help] expression has no effect - Warning. -
Miikkel - 06.07.2010
Quote:
Originally Posted by Matthias_
pawn Код:
pInfo[playerid][pSex] == 1; pInfo[playerid][pSex] == 2;
== means "is equal to". It's used in statements like these:
pawn Код:
if(pInfo[playerid][pSex] == 2) { doSomething(); }
You're supposed to use:
pawn Код:
pInfo[playerid][pSex] = 1; pInfo[playerid][pSex] = 2;
That way pInfo[playerid][pSex] is assigned to either 1 or 2.
|
Thanks alot for that information. Realy helped.
Re: [Help] expression has no effect - Warning. -
Matthias_ - 06.07.2010
You're welcome!
Re: [Help] expression has no effect - Warning. -
nissan123 - 31.08.2010
Can Anybody help me It Gave Me 6 Warnings And i Done Was The Warning said Was warning 204: symbol is assigned a value that is never used: "sf"
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\filtersc ripts\sfpd.pwn(24) : warning 204: symbol is assigned a value that is never used: "sf2" and another warning was warning 215: expression has no effect,and the down one is the one i scripted
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#define FILTERSCRIPT
#pragma tabsize 0
new sf;
new sf2;
#define MoveObject
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" SFPD Gates Created By GTRSkyYo");
print("--------------------------------------\n");
sf = CreateObject(980, -1624.64, 688.20, 9.00, 0.00, 0.00, 180.00);
sf2 = CreateObject(980, -1634.78, 688.19, 9.00, 0.00, 0.00, 180.00);
sf = CreateObject(980, -1624.64, 688.20, 14.00, 0.00, 0.00, 180.00);
sf2 = CreateObject(980, -1634.78, 688.19, 14.00, 0.00, 0.00, 180.00);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/sfpd2", cmdtext, true) == 0)
{
MoveObject(sf, -1624.64, 688.20, 9.00, 0.00, 0.00, 180.00);
MoveObject(sf2, -1634.78, 688.19, 9.00, 0.00, 0.00, 180.00);
SendClientMessage(playerid, 0x0000FFAA, "You Have Opened The San Fransico Deparment Gates");
return 1;
}
if (strcmp("/sfpd", cmdtext, true) == 0)
{
MoveObject(sf, -1624.64, 688.20, 14.00, 0.00, 0.00, 180.00);
MoveObject(sf2, -1634.78, 688.19, 14.00, 0.00, 0.00, 180.00);
SendClientMessage(playerid, 0x0000FFAA, "You Have Closed The San Fransico Deparment Gates");
return 1;
}
return 0;
}
Re: [Help] expression has no effect - Warning. -
krystiang1 - 25.11.2011
Quote:
Originally Posted by nissan123
Can Anybody help me It Gave Me 6 Warnings And i Done Was The Warning said Was warning 204: symbol is assigned a value that is never used: "sf"
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\filtersc ripts\sfpd.pwn(24) : warning 204: symbol is assigned a value that is never used: "sf2" and another warning was warning 215: expression has no effect,and the down one is the one i scripted
pawn Код:
// This is a comment // uncomment the line below if you want to write a filterscript //#define FILTERSCRIPT
#include <a_samp> #define FILTERSCRIPT #pragma tabsize 0 new sf; new sf2; #define MoveObject
#if defined FILTERSCRIPT
public OnFilterScriptInit() { print("\n--------------------------------------"); print(" SFPD Gates Created By GTRSkyYo"); print("--------------------------------------\n"); sf = CreateObject(980, -1624.64, 688.20, 9.00, 0.00, 0.00, 180.00); sf2 = CreateObject(980, -1634.78, 688.19, 9.00, 0.00, 0.00, 180.00); sf = CreateObject(980, -1624.64, 688.20, 14.00, 0.00, 0.00, 180.00); sf2 = CreateObject(980, -1634.78, 688.19, 14.00, 0.00, 0.00, 180.00); return 1; }
public OnFilterScriptExit() { return 1; }
#else
main() { print("\n----------------------------------"); print(" Blank Gamemode by your name here"); print("----------------------------------\n"); }
#endif
public OnGameModeInit() { // Don't use these lines if it's a filterscript SetGameModeText("Blank Script"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); return 1; }
public OnGameModeExit() { return 1; }
public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746); return 1; }
public OnPlayerConnect(playerid) { return 1; }
public OnPlayerDisconnect(playerid, reason) { return 1; }
public OnPlayerSpawn(playerid) { return 1; }
public OnPlayerDeath(playerid, killerid, reason) { return 1; }
public OnVehicleSpawn(vehicleid) { return 1; }
public OnVehicleDeath(vehicleid, killerid) { return 1; }
public OnPlayerText(playerid, text[]) { return 1; }
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/sfpd2", cmdtext, true) == 0) { MoveObject(sf, -1624.64, 688.20, 9.00, 0.00, 0.00, 180.00); MoveObject(sf2, -1634.78, 688.19, 9.00, 0.00, 0.00, 180.00); SendClientMessage(playerid, 0x0000FFAA, "You Have Opened The San Fransico Deparment Gates"); return 1; } if (strcmp("/sfpd", cmdtext, true) == 0) { MoveObject(sf, -1624.64, 688.20, 14.00, 0.00, 0.00, 180.00); MoveObject(sf2, -1634.78, 688.19, 14.00, 0.00, 0.00, 180.00); SendClientMessage(playerid, 0x0000FFAA, "You Have Closed The San Fransico Deparment Gates"); return 1; } return 0; }
|
I think what it is saying is that those two words -
new sf; and
new sf2; are not being used in the script.
I think you can just delete them.
See if that helps, if it causes errors place them back.
Also its just a warning, you are still aloud to use your script.