CreateDynamicObject(988, -488.89850, -562.67981, 25.35821, 0.00000, 0.00000, 0.00000);
this Filterscript can make Open and close gates anywhere
https://sampforum.blast.hk/showthread.php?tid=345906 |
new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); if (strcmp(name, "[BD]", true, 4)) { // Do code here }
MoveDynamicObject(objectid, Float:x, Float:y, Float:z, Float:speed, Float:rx, Float:ry, Float:rz);
Use strcmp to check the player-name.
Setting the last parameter to 4 means that only the first 4 characters will be compared. Код:
new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); if (strcmp(name, "[BD]", true, 4)) { // Do code here } Код:
MoveDynamicObject(objectid, Float:x, Float:y, Float:z, Float:speed, Float:rx, Float:ry, Float:rz); |
new GateObj; public OnGameModeInit() { GateObj = CreateDynamicObject(988, -488.89850, -562.67981, 25.35821, 0.00000, 0.00000, 0.00000); SetTimer("Gate", 500, true); return 1; } forward Gate(); public Gate() { for(new i = 0; i < MAX_PLAYERS; i ++) { if(!IsPlayerConnected(i)) continue; if(IsPlayerInRangeOfPoint(i, 7.0, 488.89850, -562.67981, 25.35821)) { new Name[24]; GetPlayerName(i, Name, 24); if(strfind(Name, "[BD]", true) != -1) MoveObject(GateObj, -488.89850, -562.67981, 35.35821, 5.0, 0.0, 0.0, 0.0); } else MoveObject(GateObj, -488.89850, -562.67981, 25.35821, 5.0, 0.0, 0.0, 0.0); } return 1; }
This?
Код:
new GateObj; public OnGameModeInit() { GateObj = CreateDynamicObject(988, -488.89850, -562.67981, 25.35821, 0.00000, 0.00000, 0.00000); SetTimer("Gate", 500, true); return 1; } forward Gate(playerid); public Gate(playerid) { if(IsPlayerInRangeOfPoint(playerid, 7.0, 488.89850, -562.67981, 25.35821)) { new Name[24]; GetPlayerName(playerid, Name, 24); if(strfind(Name, "[BD]", true) != -1) MoveObject(GateObj, -488.89850, -562.67981, 35.35821, 5.0, 0.0, 0.0, 0.0); } else MoveDynamicObject(GateObj, -488.89850, -562.67981, 25.35821, 5.0, 0.0, 0.0, 0.0); return 1; } |
SetTimer("Gate", 500, true);
forward Gate(playerid);
public Gate(playerid)
PHP код:
|
if(IsPlayerInRangeOfPoint(i,3.0,-488.89850, -562.67981, 25.35821) && strcmp(GetName(i), "[BD]", true, 4)) { if(GateOpen = 0) { MoveDynamicObject(BDgate, -488.89850, -562.67981, 26, 3.0, Float:rx = -1000.0, Float:ry = -1000.0, Float:rz = -1000.0); GateOpen = 1; } } else if(GateOpen = 1) { MoveDynamicObject(BDgate, -488.89850, -562.67981, 25.35821, 3.0, Float:rx = -1000.0, Float:ry = -1000.0, Float:rz = -1000.0); GateOpen = 0: }
This?
Код:
new GateObj; public OnGameModeInit() { GateObj = CreateDynamicObject(988, -488.89850, -562.67981, 25.35821, 0.00000, 0.00000, 0.00000); SetTimer("Gate", 500, true); return 1; } forward Gate(); public Gate() { for(new i = 0; i < MAX_PLAYERS; i ++) { if(!IsPlayerConnected(i)) continue; if(IsPlayerInRangeOfPoint(i, 7.0, 488.89850, -562.67981, 25.35821)) { new Name[24]; GetPlayerName(i, Name, 24); if(strfind(Name, "[BD]", true) != -1) MoveObject(GateObj, -488.89850, -562.67981, 35.35821, 5.0, 0.0, 0.0, 0.0); } else MoveObject(GateObj, -488.89850, -562.67981, 25.35821, 5.0, 0.0, 0.0, 0.0); } return 1; } |
PHP код:
|
(17) : error 017: undefined symbol "GetPlayerPoolSize" (21) : warning 211: possibly unintended assignment (23) : error 017: undefined symbol "rx" (23) : warning 215: expression has no effect (23) : error 017: undefined symbol "rz" (23) : warning 215: expression has no effect (23) : error 001: expected token: ";", but found ")" (23) : fatal error 107: too many error messages on one line
It's not working, the gate isn't opening at all..
It gives these errors: Код:
(17) : error 017: undefined symbol "GetPlayerPoolSize" (21) : warning 211: possibly unintended assignment (23) : error 017: undefined symbol "rx" (23) : warning 215: expression has no effect (23) : error 017: undefined symbol "rz" (23) : warning 215: expression has no effect (23) : error 001: expected token: ";", but found ")" (23) : fatal error 107: too many error messages on one line |
MoveDynamicObject(BDgate, -488.89850, -562.67981, 26, 3.0); MoveDynamicObject(BDgate, -488.89850, -562.67981, 25.35821, 3.0);
if (GateOpen == 0)
// at the top of your script new BDgate; public OnGameModeInit() { BDgate = CreateDynamicObject(988, -488.89850, -562.67981, 25.35821, 0.00000, 0.00000, 0.00000); return 1; } public OnPlayerSpawn(playerid) { SetTimer("BDGateCheck", 500, true); return 1; } forward BDGateCheck(playerid); public BDGateCheck(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); if(IsPlayerInRangeOfPoint(i, 5.0, -488.89850, -562.67981, 25.35821) && strcmp(name, "[BD]", true, 4)) MoveDynamicObject(BDgate, -488.89850, -562.67981, 20, 3.0); // Open the gate else MoveDynamicObject(BDgate, -488.89850, -562.67981, 25.35821, 3.0); // Close the gate return 1; }