Scripting Help Needed! Laptop and Internet system!
#1

Okey guys, im kinda new to sa-mp scripting and PAWN but ive scripted in other languages before.
Im working on a server called slakthuset roleplay, a fairly new server wich has been up for 1 month.
Now, it was my idea to add a laptop system... So you can surf the "web" and write "e-mails" and chat with some kind of messenger..
As i said im pretty new to this stuff, Ive added a buyable laptop at 24/7 but i get ALOT of errors..
This is how im doing, first i have two things:
Код:
pLaptop
And

Код:
pLaptopOn
Code to turn on the laptop:
Код:
	if(strcmp(cmd, "/laptop on", true) == 0)
	{
		if(IsPlayerConnected(playerid))
    	{
			if(PlayerInfo[pLaptop] == 1) || if(PlayerInfo[pLaptop] == 2)
     	{
      	if(PlayerInfo[playerid][pLaptopOn] == "Off")
				{
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s flips open his Laptop and turns it on.", sendername);
					ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					PlayerInfo[playerid][pLaptopOn] == "On")
					SendClientMessage(playerid, COLOR_WHITE, "COMPUTER: Welcome");
					SendClientMessage(playerid, COLOR_LIGHTBLUE, "What Would you like to do?");
				  SendClientMessage(playerid, COLOR_GRAD1, "| 1: Internet");
				  SendClientMessage(playerid, COLOR_GRAD1, "| 2: Write Note");
				  SendClientMessage(playerid, COLOR_GRAD2, "| 3: OnLine AD");
				  SendClientMessage(playerid, COLOR_GRAD3, "| 4: SHIM Messenger");
                            SendClientMessage(playerid, COLOR_GRAD3, "| 5: SHIM E-Mail");
				else
				{
					SendClientMessage(playerid, COLOR_LIGHTBLUE, " Your laptop is already running!");
					return 1;
				}
			}
		}
 		return 1;
	}
And code for the 24/7 item
First ive added this
Код:
			SendClientMessage(playerid, COLOR_GRAD4, "| 15: IDN Laptop");
So pepole know the number.. xD
Actual code for buying..
Код:
			else if (item == 15 && GetPlayerMoney(playerid) > 999)
			{
			  if(PlayerInfo[playerid][pLaptop] = 0)
			  {	  
				  SafeGivePlayerMoney(playerid, - 1000);
				  PlayerInfo[playerid][pLaptop] = "IDN";
				  PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				  format(string, sizeof(string), "~r~-$%d", 5);
				  GameTextForPlayer(playerid, string, 5000, 1);
				  SendClientMessage(playerid, COLOR_GRAD4, "You bought a IDN Laptop!");
				  SendClientMessage(playerid, COLOR_GRAD4, "HINT: Use '/laptop on' to turn it on!");
			   	OnPlayerUpdate(playerid);
				  return 1;
				}
			}
			
		}
		return 1;
	}
Added things at OnPlayerConnect
Код:
public OnPlayerConnect(playerid)
Код:
PlayerInfo[playerid][pLaptop] = 0;
	PlayerInfo[playerid][pLaptopOn] = 0;
Added this...
Код:
public ShowStats(playerid,targetid)
Код:
		new lrank[20];
		if(PlayerInfo[targetid][pLaptop] == 1) { lrank = "IDN"; }
		else if(PlayerInfo[targetid][pLaptop] >= 2) { lrank = "Dlee"; }
		else { lrank = "None"; }
And this...
Код:
public OnPlayerRegister(playerid, password[])
Код:
				format(var, 64, "Laptop=%d\n",PlayerInfo[playerid][pLaptop]);fwrite(hFile, var);
	      format(var, 64, "LaptopOn=%d\n",PlayerInfo[playerid][pLaptopOn]);fwrite(hFile, var);
Код:
public OnPlayerLogin(playerid,password[])
Код:
					if( strcmp( key , "Laptop" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLaptop] = strval( val ); }
					if( strcmp( key , "LaptopOn" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLaptopOn] = strval( val ); }
NOW! If i do this.. i getta hole lot of errors... some saying "PlayerToPoint is not implemented" or "i is not implemented"
Then i marked the "/laptop on" part marked as comment i got fewer errors, ill post them here.

C:\Documents and Settings\Oscar\Mina dokument\laptop.pwn(24562) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Oscar\Mina dokument\laptop.pwn(24562) : warning 215: expression has no effect
C:\Documents and Settings\Oscar\Mina dokument\laptop.pwn(24562) : error 001: expected token: ";", but found "if"
C:\Documents and Settings\Oscar\Mina dokument\laptop.pwn(24564) : warning 211: possibly unintended assignment
C:\Documents and Settings\Oscar\Mina dokument\laptop.pwn(24567) : error 006: must be assigned to an array

Mostly the errors are in the 24/7 part...

If i've totally messed up, feel free to help me!

Regards.
// Joel

P.S We're using LARP, Los angeles Roleplay mod (GM)
Reply


Messages In This Thread
Scripting Help Needed! Laptop and Internet system! - by Joel_Krantz - 17.04.2009, 22:23
Re: Scripting Help Needed! Laptop and Internet system! - by MenaceX^ - 17.04.2009, 22:51
Re: Scripting Help Needed! Laptop and Internet system! - by Joel_Krantz - 18.04.2009, 09:58
Re: Scripting Help Needed! Laptop and Internet system! - by DMSOrg - 18.04.2009, 12:04

Forum Jump:


Users browsing this thread: 1 Guest(s)