Wenn ich /blitzer eingebe kommt die erste SScanf abfrage ja und wenn ic hdann /blitzer new ..... eingebe passie��rt nix
Hir der befehl:
ocmd:blitzer(playerid, params[])
{
new speed, radius, name[128], cname[128], Float:x, Float:y, Float:z;
if(sscanf(params, "s", cname)){
SendClientMessage(playerid,-1,"[Benutzung]: /blitzer [Name]");
SendClientMessage(playerid,-1,"[Namen]: new || remove || removeall");
return 1;
}
if(!strcmp(cname, "new", true)) {
if(sscanf(params, "siis",cname, speed, radius,name))return SendClientMessage(playerid,-1,"[Benutzung]: /blitzer new [Geschwindigkeit] [Radius] [Name Des Blitzers(Standort)]");
GetPlayerPos(playerid,x,y,z);
for(new i = 0; i < sizeof(Blitzer); i++)
{
if(Blitzer[i][Erstellt] == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) {
Blitzer[i][BlitzerX] = x;
Blitzer[i][BlitzerY] = y;
Blitzer[i][BlitzerZ] = z;
Blitzer[i][Geschwindigkeit] = speed;
Blitzer[i][BlitzerName] = name;
Blitzer[i][Radius] = radius;
Blitzer[i][Erstellt] = 1;
Blitzer[i][ID] = CreateObject(18880, x + 1.0, y + 1.0, z-2, 0.0, 0.0, 10);
} else {
Blitzer[i][BlitzerX] = x;
Blitzer[i][BlitzerY] = y;
Blitzer[i][BlitzerZ] = z;
Blitzer[i][Geschwindigkeit] = speed;
Blitzer[i][BlitzerName] = name;
Blitzer[i][Radius] = radius;
Blitzer[i][Erstellt] = 2;
TogglePlayerControllable(playerid,0);
}
return 1;
}
}
formatEx(playerid,-1,"Du hast einen Blitzer aufgestellt. Max. Geschwindigkeit: %i Radius: %i Name: %s",speed,radius,name);
}
if(!strcmp(cname, "remove", true)) {
if(sscanf(params, "s", cname))return SendClientMessage(playerid,-1,"[Benutzung]: /blitzer remove");
for(new i = 0; i < sizeof(Blitzer); i++)
{
if(Blitzer[i][Erstellt] == 1 && Blitzer[i][Erstellt] == 2)
{
if(IsPlayerInRangeOfPoint(playerid, Blitzer[i][Radius], Blitzer[i][BlitzerX], Blitzer[i][BlitzerY], Blitzer[i][BlitzerZ]))
{
if(!IsPlayerInAnyVehicle(playerid)) {
Blitzer[i][Erstellt] = 0;
Blitzer[i][BlitzerX] = 0.0;
Blitzer[i][BlitzerY] = 0.0;
Blitzer[i][BlitzerZ] = 0.0;
DestroyObject(Blitzer[i][ID]);
} else {
Blitzer[i][Erstellt] = 0;
Blitzer[i][BlitzerX] = 0.0;
Blitzer[i][BlitzerY] = 0.0;
Blitzer[i][BlitzerZ] = 0.0;
TogglePlayerControllable(playerid,1);
}
return 1;
} else {
SendClientMessage(playerid,-1,"Du musst in der nähe von einem Blitzer stehen!");
}
}
}
}
if(!strcmp(cname, "removeall", true)) {
if(sscanf(params, "s", cname))return SendClientMessage(playerid,-1,"[Benutzung]: /blitzer removeall");
for(new i = 0; i < sizeof(Blitzer); i++)
{
if(Blitzer[i][Erstellt] == 1)
{
Blitzer[i][Erstellt] = 0;
Blitzer[i][BlitzerX] = 0.0;
Blitzer[i][BlitzerY] = 0.0;
Blitzer[i][BlitzerZ] = 0.0;
DestroyObject(Blitzer[i][ID]);
}
}
}
return 1;
}
{
new speed, radius, name[128], cname[128], Float:x, Float:y, Float:z;
if(sscanf(params, "s", cname)){
SendClientMessage(playerid,-1,"[Benutzung]: /blitzer [Name]");
SendClientMessage(playerid,-1,"[Namen]: new || remove || removeall");
return 1;
}
if(!strcmp(cname, "new", true)) {
if(sscanf(params, "siis",cname, speed, radius,name))return SendClientMessage(playerid,-1,"[Benutzung]: /blitzer new [Geschwindigkeit] [Radius] [Name Des Blitzers(Standort)]");
GetPlayerPos(playerid,x,y,z);
for(new i = 0; i < sizeof(Blitzer); i++)
{
if(Blitzer[i][Erstellt] == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) {
Blitzer[i][BlitzerX] = x;
Blitzer[i][BlitzerY] = y;
Blitzer[i][BlitzerZ] = z;
Blitzer[i][Geschwindigkeit] = speed;
Blitzer[i][BlitzerName] = name;
Blitzer[i][Radius] = radius;
Blitzer[i][Erstellt] = 1;
Blitzer[i][ID] = CreateObject(18880, x + 1.0, y + 1.0, z-2, 0.0, 0.0, 10);
} else {
Blitzer[i][BlitzerX] = x;
Blitzer[i][BlitzerY] = y;
Blitzer[i][BlitzerZ] = z;
Blitzer[i][Geschwindigkeit] = speed;
Blitzer[i][BlitzerName] = name;
Blitzer[i][Radius] = radius;
Blitzer[i][Erstellt] = 2;
TogglePlayerControllable(playerid,0);
}
return 1;
}
}
formatEx(playerid,-1,"Du hast einen Blitzer aufgestellt. Max. Geschwindigkeit: %i Radius: %i Name: %s",speed,radius,name);
}
if(!strcmp(cname, "remove", true)) {
if(sscanf(params, "s", cname))return SendClientMessage(playerid,-1,"[Benutzung]: /blitzer remove");
for(new i = 0; i < sizeof(Blitzer); i++)
{
if(Blitzer[i][Erstellt] == 1 && Blitzer[i][Erstellt] == 2)
{
if(IsPlayerInRangeOfPoint(playerid, Blitzer[i][Radius], Blitzer[i][BlitzerX], Blitzer[i][BlitzerY], Blitzer[i][BlitzerZ]))
{
if(!IsPlayerInAnyVehicle(playerid)) {
Blitzer[i][Erstellt] = 0;
Blitzer[i][BlitzerX] = 0.0;
Blitzer[i][BlitzerY] = 0.0;
Blitzer[i][BlitzerZ] = 0.0;
DestroyObject(Blitzer[i][ID]);
} else {
Blitzer[i][Erstellt] = 0;
Blitzer[i][BlitzerX] = 0.0;
Blitzer[i][BlitzerY] = 0.0;
Blitzer[i][BlitzerZ] = 0.0;
TogglePlayerControllable(playerid,1);
}
return 1;
} else {
SendClientMessage(playerid,-1,"Du musst in der nähe von einem Blitzer stehen!");
}
}
}
}
if(!strcmp(cname, "removeall", true)) {
if(sscanf(params, "s", cname))return SendClientMessage(playerid,-1,"[Benutzung]: /blitzer removeall");
for(new i = 0; i < sizeof(Blitzer); i++)
{
if(Blitzer[i][Erstellt] == 1)
{
Blitzer[i][Erstellt] = 0;
Blitzer[i][BlitzerX] = 0.0;
Blitzer[i][BlitzerY] = 0.0;
Blitzer[i][BlitzerZ] = 0.0;
DestroyObject(Blitzer[i][ID]);
}
}
}
return 1;
}