SA-MP Forums Archive
Confused about code - 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: Confused about code (/showthread.php?tid=76438)



Confused about code - Robbin237 - 04.05.2009

The problem is when i have used my command to set the HouseClosed[playerid] to 0.
I want it to be like this: Only eros can enter the house, and the rest will get the message that the house is closed. The problem: Everyone can still enter when the house is closed, can somebody help me?

Im actually a little bit confused about my own code.
Also the HouseClosed[ID] must be eros's house. Dont get it how

This gets called when a player enters the checkpoint to enter the house:

pawn Код:
new Name[MAX_PLAYER_NAME+1];
new ID;

for(new i=0; i<MAX_PLAYERS; i++)
{
  if(IsPlayerConnected(i)) {
    GetPlayerName(i, Name, sizeof(Name));
    ID = GetPlayerID(Name);

    if(strcmp(Name, "Eros")) {
      if(HouseClosed[ID] == 1) return SendClientMessage(playerid, COLOR_RED, "This House Is Currently Closed To Visitors.");
    }
  }
}
Thnx!!!


Re: Strcmp not working again... - Diler - 04.05.2009

Код:
if(strcmp(Name, "Eros",true)==0) {
? xd


Re: Confused about code - Robbin237 - 04.05.2009

Im still confused about the whole thing (The strcmp part)
If its not eros, it should get the house is not open message, else he must be able to enter.

Damn :S


Re: Confused about code - Joe Staff - 04.05.2009

strcmp gives 0 when it's an exact match