14.06.2011, 19:52
Код:
// This is a comment // uncomment the line below if you want to write a filterscript #define FILTERSCRIPT #include <a_samp> forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z); #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Blank Filterscript by your name here"); print("--------------------------------------\n"); 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 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 OnPlayerCommandText(playerid, cmdtext[]) if(!strcmp("/Enter", cmdtext, true)) { if(IsPlayerInRangeOfPoint(playerid,3,1333.5809326172,-1863.5708007813,14.039328575134)) { SetPlayerInterior(playerid, 1); SetPlayerPos(playerid,2064.185546875,-2071.7348632813,1115.2646484375); CreatePickup(1239,2,1333.5863037109,-1864.8194580078,14.652570724487); return 1; } if(IsPlayerInRangeOfPoint(playerid, 3, 5000, 5000, 5000)) { SetPlayerPos(playerid,2064.185546875,-2071.7348632813,1115.2646484375); return 1; } if(IsPlayerInRangeOfPoint(playerid, 3, 6000, 6000, 6000)) { // Do something here, etc etc } } if(!strcmp("/Exit", cmdtext, true)) { if(IsPlayerInRangeOfPoint(playerid,3,2064.185546875,-2071.7348632813,1115.2646484375)) { SetPlayerInterior(playerid, 1); SetPlayerPos(playerid,1333.5809326172,-1863.5708007813,14.039328575134); CreatePickup(1239,2,1333.5863037109,-1864.8194580078,14.652570724487); return 1; } if(IsPlayerInRangeOfPoint(playerid, 3, 5000, 5000, 5000)) { SetPlayerPos(playerid,1333.5809326172,-1863.5708007813,14.039328575134); return 1; } if(IsPlayerInRangeOfPoint(playerid, 3, 6000, 6000, 6000)) { // Do something here, etc etc } } public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z) { if(IsPlayerConnected(playerid)) { new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetPlayerPos(playerid, oldposx, oldposy, oldposz); tempposx = (oldposx -x); tempposy = (oldposy -y); tempposz = (oldposz -z); //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz); if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { return 1; } } return 0; }