09.10.2011, 10:23
Hi,
the only problem i have: When im a Cop (polizei) i canґt enter the bikeґs(polizeiauto), please can you help me with this? I think its something about "GetPVarInt", what is this?
Thank you!
the only problem i have: When im a Cop (polizei) i canґt enter the bikeґs(polizeiauto), please can you help me with this? I think its something about "GetPVarInt", what is this?
Thank you!
Код:
// Includes===================================================================== #include <a_samp> #include <dini> // Farben======================================================================= #define COLOR_LIGHTRED 0xFF6347AA #define COLOR_GREY 0xAFAFAFAA // Pragmas====================================================================== #pragma tabsize 0 #pragma unused strtok // Teams======================================================================== #define TEAM_POLIZEI 2 #define TEAM_BUNDESWEHR 3 #define TEAM_KRANKENHAUS 4 #define TEAM_FBI 5 #define TEAM_NANG 6 #define TEAM_BIKER 7 #define TEAM_STADTWERKE 8 #define TEAM_69 9 #define TEAM_AUFTRAGSMЦRDER 10 #define TEAM_TRIADEN 11 #define TEAM_NTV 12 // Enums======================================================================== enum spieler_daten { wanted, skin, leader, team, money, score, eingeloggt } // NEWґS======================================================================== new Spieler[MAX_PLAYERS][spieler_daten]; new polizeiauto[3]; // Defines====================================================================== #define DIALOG_LOGIN 3 #define DIALOG_REG 4 // Mainscript=================================================================== main() { print("\n----------------------------------"); print(" LIFE by KampfMopZ"); print("----------------------------------\n"); } // OnGameModeInt================================================================ public OnGameModeInit() { SetGameModeText("German Reallife"); AddPlayerClass(20,-1493.0544,920.2812,7.1875,86.9809,0,0,0,0,0,0); polizeiauto[0] =AddStaticVehicle(522,-1611.9084,674.2100,6.7599,0.7887,255,255); // pd bike polizeiauto[1] =AddStaticVehicle(522,-1604.3065,692.6819,-5.6689,0.1237,3,8); // pd streife polizeiauto[2] =AddStaticVehicle(522,-1600.4744,691.7789,-5.6715,358.8928,3,8); // pd Streife return 1; } // OnPlayerRequestClass========================================================= 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; } // OnPlayerConnect============================================================== public OnPlayerConnect(playerid) { new pname[MAX_PLAYERS],accFormat[128]; GetPlayerName(playerid,pname,sizeof pname); format(accFormat,sizeof accFormat,"%s.datei",pname); if(fexist(accFormat)) { ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich ein","Weiter","Abbrechen"); } else { ShowPlayerDialog(playerid,DIALOG_REG,1,"Registrieren","Bitte Registriere dich","Weiter","Abbrechen"); } return 1; } // OnPlayerDisconnect=========================================================== public OnPlayerDisconnect(playerid, reason) { new pname[MAX_PLAYERS],accFormat[128]; GetPlayerName(playerid,pname,sizeof pname); format(accFormat,sizeof accFormat,"%s.datei",pname); dini_IntSet(accFormat, "skin", GetPlayerSkin(playerid)); if(fexist(accFormat) && Spieler[playerid][eingeloggt]) { dini_IntSet(accFormat,"team",Spieler[playerid][team]); dini_IntSet(accFormat,"leader",Spieler[playerid][leader]); dini_IntSet(accFormat,"wanted",Spieler[playerid][wanted]); dini_IntSet(accFormat,"skin",Spieler[playerid][skin]); } Spieler[playerid][team] = 0; Spieler[playerid][eingeloggt] = 0; Spieler[playerid][leader] = 0; Spieler[playerid][wanted] = 0; Spieler[playerid][skin] = GetPlayerSkin(playerid); return 1; } // OnPlayerDeath================================================================ public OnPlayerDeath(playerid, killerid, reason) { return 1; } public OnPlayerSpawn(playerid) { new pname[MAX_PLAYERS],accFormat[128]; GetPlayerName(playerid,pname,sizeof pname); format(accFormat,sizeof accFormat,"%s.datei",pname); SetPlayerSkin(playerid, dini_Int(accFormat,"skin")); { } if(Spieler[playerid][team] == 1) //team polizei { SetPlayerPos(playerid, -1606.1589,674.1307,-5.2422 ); SetPlayerFacingAngle(playerid,356.4575); SetPlayerInterior(playerid, 0); SetPlayerSkin(playerid, 280); GivePlayerWeapon(playerid, 24, 86); GivePlayerWeapon(playerid, 29, 150); GivePlayerWeapon(playerid, 3, 0); } if(Spieler[playerid][team] == 2) //team Bundeswehr { SetPlayerPos(playerid, 211.2492,1811.6134,21.8594 ); SetPlayerFacingAngle(playerid,6.2783); SetPlayerInterior(playerid, 0); SetPlayerSkin(playerid, 287); GivePlayerWeapon(playerid, 24, 50); GivePlayerWeapon(playerid, 31, 170); GivePlayerWeapon(playerid, 27, 84); } if(Spieler[playerid][team] == 3) //team Krankenhaus { SetPlayerPos(playerid, -2706.5664,638.3166,14.4545 ); SetPlayerFacingAngle(playerid,228.5291); SetPlayerInterior(playerid, 0); SetPlayerSkin(playerid, 276); GivePlayerWeapon(playerid, 24, 14); } if(Spieler[playerid][team] == 4) //team FBI { SetPlayerPos(playerid, -2446.5183,517.1216,30.2308 ); SetPlayerFacingAngle(playerid,281.0992); SetPlayerInterior(playerid, 0); SetPlayerSkin(playerid, 286); GivePlayerWeapon(playerid, 24, 86); GivePlayerWeapon(playerid, 29, 150); GivePlayerWeapon(playerid, 17, 2); } if(Spieler[playerid][team] == 5) //team Nang { SetPlayerPos(playerid, -2648.2249,1399.6024,912.4063 ); SetPlayerFacingAngle(playerid,10.9668); SetPlayerInterior(playerid, 0); SetPlayerSkin(playerid, 122); GivePlayerWeapon(playerid, 24, 28); GivePlayerWeapon(playerid, 29, 150); GivePlayerWeapon(playerid, 18, 2); } if(Spieler[playerid][team] == 6) //team BIKER { SetPlayerPos(playerid, 488.2935,-81.4488,998.7578 ); SetPlayerFacingAngle(playerid,358.9058); SetPlayerInterior(playerid, 6); SetPlayerSkin(playerid, 247); GivePlayerWeapon(playerid, 24, 28); GivePlayerWeapon(playerid, 25, 28); GivePlayerWeapon(playerid, 7, 0); } if(Spieler[playerid][team] == 7) //team Stadtwwerke { SetPlayerPos(playerid, -1716.7948,1018.0562,17.5859 ); SetPlayerFacingAngle(playerid,82.8659); SetPlayerInterior(playerid, 0); SetPlayerSkin(playerid, 50); GivePlayerWeapon(playerid, 24, 28); GivePlayerWeapon(playerid, 6, 0); } if(Spieler[playerid][team] == 8) //team 69ґ { SetPlayerPos(playerid, -1629.3293,1388.8190,7.1875 ); SetPlayerFacingAngle(playerid,327.5006); SetPlayerInterior(playerid, 0); SetPlayerSkin(playerid, 144); GivePlayerWeapon(playerid, 24, 28); GivePlayerWeapon(playerid, 5, 0); GivePlayerWeapon(playerid, 27, 28); } if(Spieler[playerid][team] == 9) //team Auftragskiller { SetPlayerPos(playerid, 2183.2971,-1203.6145,1049.0234 ); SetPlayerFacingAngle(playerid,264.5049); SetPlayerInterior(playerid, 3); SetPlayerSkin(playerid, 125); GivePlayerWeapon(playerid, 24, 28); GivePlayerWeapon(playerid, 30, 90); GivePlayerWeapon(playerid, 34, 14); } if(Spieler[playerid][team] == 10) //team Triaden { SetPlayerPos(playerid, 2319.5195,-1209.2161,1049.0234 ); SetPlayerFacingAngle(playerid,100.2676); SetPlayerInterior(playerid, 3); SetPlayerSkin(playerid, 117); GivePlayerWeapon(playerid, 24, 28); GivePlayerWeapon(playerid, 8, 0); GivePlayerWeapon(playerid, 30, 120); } if(Spieler[playerid][team] == 11) //team ntv { SetPlayerPos(playerid, -1806.5148,530.7881,35.1641 ); SetPlayerFacingAngle(playerid,358.4587); SetPlayerInterior(playerid, 0); SetPlayerSkin(playerid, 188); GivePlayerWeapon(playerid, 43, 45); GivePlayerWeapon(playerid, 24, 28); } return 1; } // onPlayerCommandText========================================================== public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp(strget(cmdtext,0),"/makeleader")) { if(IsPlayerAdmin(playerid)) { if(!strlen(strget(cmdtext,1))) return SendClientMessage(playerid,COLOR_GREY,"Benutze: /makeleader [ID] [FraktionsID]"); new string[128]; new id3 = strval(strget(cmdtext,1)); new admin3[MAX_PLAYER_NAME]; new gang = strval(strget(cmdtext,2)); GetPlayerName(id3,admin3,sizeof(admin3)); format(string, sizeof(string), "*** Du wurdest von Admin %s zum Leader der Fraktionsnummer %d gemacht.", admin3, gang); SendClientMessage(id3, COLOR_LIGHTRED, string); format(string, sizeof(string), "*** Du hast %s zum Leader der Fraktionsnummer %d gemacht.", id3, gang); SendClientMessage(playerid, COLOR_LIGHTRED, string); if(gang==1) { SetPlayerSkin(id3,280);Spieler[playerid][leader]= 1; } Spieler[id3][leader] = gang; Spieler[id3][team] = gang; } else { SendClientMessage(playerid, COLOR_LIGHTRED,"Du darfst diesen Befehl nicht benutzen !"); } return 1; } if (strcmp("/mycommand", cmdtext, true, 10) == 0) { // Do something here return 1; } return 0; } // OnPlayerStateChange public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate==PLAYER_STATE_DRIVER) { for(new i=0; i<sizeof(polizeiauto); i++) { if(GetPlayerVehicleID(playerid)==polizeiauto[i]) { if(GetPVarInt(playerid,"team")!=0) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,COLOR_LIGHTRED,"Du hast keine Schlьssel fьr dieses Fahrzeug."); } } } } return 1; } // OnDialogResponse============================================================= public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new pname[MAX_PLAYERS],accFormat[128]; GetPlayerName(playerid,pname,sizeof pname); format(accFormat,sizeof accFormat,"%s.datei",pname); if(response) { switch(dialogid) // dialogid auswдhlen { case DIALOG_LOGIN: // ID Login { if(!strlen(inputtext)) { ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich ein","Weiter","Abbrechen"); return SendClientMessage(playerid,0xFFFFFFFF,"Kein Passwort angegeben!"); } if(strcmp(inputtext,dini_Get(accFormat,"Passwort")) == 0) // Passwort Direkt aus der Datei Laden { Spieler[playerid][team] = dini_Int(accFormat,"team"); Spieler[playerid][leader] = dini_Int(accFormat,"leader"); Spieler[playerid][wanted] = dini_Int(accFormat,"wanted"); Spieler[playerid][skin] =SetPlayerSkin(playerid, dini_Int(accFormat,"skin")); Spieler[playerid][eingeloggt] = 1; // Spieler ist nun erfolgreich eingeloggt SendClientMessage(playerid,0xFFFFFFFF,"Du wurdest erfolgreich eingeloggt und kannst nun spawnen."); } else { ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich ein","Weiter","Abbrechen"); SendClientMessage(playerid,0xFFFFFFFF,"Das Passwort war falsch!"); } } case DIALOG_REG: // ID Registrieren { if(!strlen(inputtext)) // Text darf nicht = Null sein Null im Sinne von nichts { ShowPlayerDialog(playerid,DIALOG_REG,1,"Registrieren","Bitte Registriere dich","Weiter","Abbrechen"); return SendClientMessage(playerid,0xFFFFFFFF,"Das Passwort ist zu kurz!"); } dini_Create(accFormat); dini_Set(accFormat,"Passwort",inputtext); Spieler[playerid][eingeloggt] = 1; SendClientMessage(playerid,0xFFFFFFFF,"Account wurde gespeichert, du kannst jetzt spawnen."); } } } else { switch(dialogid) { case DIALOG_LOGIN:ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich ein","Weiter","Abbrechen"); case DIALOG_REG:ShowPlayerDialog(playerid,DIALOG_REG,1,"Registrieren","Bitte Registriere dich","Weiter","Abbrechen"); } } return 1; } // OnPlayerClickPlayer========================================================== public OnPlayerClickPlayer(playerid, clickedplayerid, source) { return 1; } // Socks&so===================================================================== stock strget(strx[], pos, search = ' ') { new arg, ret[128], idxx; for (new i = 0; i < strlen(strx); i++) { if(strx[i] == search || i == strlen(strx) || strx[i + 1] == 10) { arg++; if (arg == pos + 1){ ret[i-idxx] = EOS; return ret; } else if (arg == pos) idxx= i+1; } else if (arg == pos) ret[i - idxx] = strx[i]; } return ret; } strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; } new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; }