Help With script
#1

Hello i need help with my script for open a door why dosnt my script work?

First Add

Код:
new lspdgate;
and than i made this
Код:
if(strcmp(cmd, "/lspddoor", true) == 0)//DPD
	{
	    if(!IsACop(playerid))
	    {
	        SendClientMessage(playerid, COLOR_WHITE, "You are not allowed to access this gate.");
	        return 1;
		}
		else
		{
        	GetPlayerName(playerid, sendername, sizeof(sendername));
			new strGatePosition[256];
			strGatePosition = strtok(cmdtext, idx);
			if(!strlen(strGatePosition))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /lspddoor [open/close]");
				return 1;
			}
			if(strcmp(strGatePosition,"open",true) == 0)
			{
				MoveDynamicObject(lspdgate, 1495,247.880111, 72.445343, 1002.560546,0.0000,0.000000,180.000000);
				format(string, sizeof(string), "* Officer %s Opens the LSPD Door", sendername);
				ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				return 1;
			}
			else if(strcmp(strGatePosition,"close",true) == 0)
			{
				MoveDynamicObject(lspdgate, 1495,244.894638, 72.445343, 1002.560546,0.0000,0.000000,0.000000);
				format(string, sizeof(string), "* Officer %s Closes the LSPD Door", sendername);
				ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				return 1;
			}
			else
			{
			    SendClientMessage(playerid, COLOR_WHITE, "Unknown command!");
			    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /lspddoor [open/close]");
			    return 1;
			}
		}
 	}
any1 now why i get errors in my gm?

Код:
C:\Users\Alex\Desktop\GM GTA\gamemodes\lslrp.pwn(22310) : warning 217: loose indentation
C:\Users\Alex\Desktop\GM GTA\gamemodes\lslrp.pwn(22329) : warning 202: number of arguments does not match definition
C:\Users\Alex\Desktop\GM GTA\gamemodes\lslrp.pwn(22329) : warning 202: number of arguments does not match definition
C:\Users\Alex\Desktop\GM GTA\gamemodes\lslrp.pwn(22329) : warning 202: number of arguments does not match definition
C:\Users\Alex\Desktop\GM GTA\gamemodes\lslrp.pwn(22336) : warning 202: number of arguments does not match definition
C:\Users\Alex\Desktop\GM GTA\gamemodes\lslrp.pwn(22336) : warning 202: number of arguments does not match definition
C:\Users\Alex\Desktop\GM GTA\gamemodes\lslrp.pwn(22336) : warning 202: number of arguments does not match definition
C:\Users\Alex\Desktop\GM GTA\gamemodes\lslrp.pwn(22350) : warning 217: loose indentation
I Tested It In Game And Resultate Was
/lspddoor open >>Officer Alex_slav Opens The Lspd Door
/lspddoor close >>Officer Alex_slav Closes The Lspd Door

and then i get error in my Consolle stands

Код:
MoveDynamicObject Expecting 5 parameters
Код:
MoveDynamicObject Expecting 5 parameters
Код:
MoveDynamicObject Expecting 5 parameters
Код:
MoveDynamicObject Expecting 5 parameters
Код:
MoveDynamicObject Expecting 5 parameters
and position on doors
Код:
Код:
 	CreateDynamicObject(1495,247.880111, 72.445343, 1002.560546,0.0000,0.000000,180.000000); //lspddoor1 3
 	CreateDynamicObject(1495,244.894638, 72.445343, 1002.560546,0.0000,0.000000,0.000000); //lspddoor2 4
help me solve please

the script i took it from was

Код:
    if(strcmp(cmd, "/dpd", true) == 0)//DPD
	{
	    if(!IsACop(playerid))
	    {
	        SendClientMessage(playerid, COLOR_WHITE, "You are not allowed to access this gate.");
	        return 1;
		}
		else
		{
        	GetPlayerName(playerid, sendername, sizeof(sendername));
			new strGatePosition[256];
			strGatePosition = strtok(cmdtext, idx);
			if(!strlen(strGatePosition))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dpd [open/close]");
				return 1;
			}
			if(strcmp(strGatePosition,"open",true) == 0)
			{
				MoveDynamicObject(dpdgate, 1410.7500,415.9500,10.0000, 5);
				format(string, sizeof(string), "* Officer %s Opens the SAST Gate", sendername);
				ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				return 1;
			}
			else if(strcmp(strGatePosition,"close",true) == 0)
			{
				MoveDynamicObject(dpdgate, 1410.7500,415.9500,20.0000, 5);
				format(string, sizeof(string), "* Officer %s Closes the SAST gate", sendername);
				ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				return 1;
			}
			else
			{
			    SendClientMessage(playerid, COLOR_WHITE, "Unknown command!");
			    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dpd [open/close]");
			    return 1;
			}
		}
 	}
i kinda understand that it has somthing to do with the position
like this is the SAST GATE wich working
Код:
(dpdgate, 1410.7500,415.9500,20.0000, 5);
and than the one i use
Код:
(lspdgate, 1495,244.894638, 72.445343,
Reply
#2

add me in msn pyrokar@libero.it i help u
Reply
#3

show us your error lines only
Reply
#4

I'm not sure where those errors are pointing, I can't be bothered looking for them without knowing the line numbers! Although I can see straight away the the loose indentation is pointing to this line

pawn Код:
GetPlayerName(playerid, sendername, sizeof(sendername));
Simply because it's not indented properly, along with several other parts of the scripts that the compiler simply isn't throwing out warnings for lack of proper indentation.

Also you should note that you're moving an object with the ID of 0? You don't assign the variable the ID of the object, so how is Pawn supposed to know which object you want to move! You need to assign the object ID to a variable if you wish to move it at a later stage, like so:

pawn Код:
new lspdgate;
pawn Код:
lspdgate = CreateDynamicObject(1495,247.880111, 72.445343, 1002.560546,0.0000,0.000000,180.000000); //lspddoor1 3
I recommend you read the official Pawn documentation to become more aware of how Pawn works and the basics of programming in the language!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)